p****1 发帖数: 275 | 1 有兴趣做不? 我琢磨着, 出题的人是在寻找最优解 :)
Given the table [tSWIFT_History_Trades] , the C# structure TradeNAK and the
C# method UpdateTradeACKNAKDB as defined below:
CREATE TABLE [tSWIFT_History_Trades](
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[BatchId] [varchar](25) NOT NULL,
[TradeId] [varchar](25) NOT NULL,
[Account] [varchar](25) NULL,
[TranType] [varchar](50) NULL,
[TradeDate] [int] NULL,
[SettleDate] [int] NULL,
[Exch] [varchar... 阅读全帖 |
|
p****1 发帖数: 275 | 2 Question:
Given the table [tSWIFT_History_Trades] , the C# structure TradeNAK and the
C# method UpdateTradeACKNAKDB as defined below:
CREATE TABLE [tSWIFT_History_Trades](
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[BatchId] [varchar](25) NOT NULL,
[TradeId] [varchar](25) NOT NULL,
[Account] [varchar](25) NULL,
[TranType] [varchar](50) NULL,
[TradeDate] [int] NULL,
[SettleDate] [int] NULL,
[Exch] [varchar](50) NULL,
[D... 阅读全帖 |
|
p****1 发帖数: 275 | 3 【 以下文字转载自 JobHunting 讨论区 】
发信人: peace1 (peace1), 信区: JobHunting
标 题: C#, recruiter发过来的面试题
发信站: BBS 未名空间站 (Thu Sep 8 22:17:38 2016, 美东)
有兴趣做不? 我琢磨着, 出题的人是在寻找最优解 :)
Given the table [tSWIFT_History_Trades] , the C# structure TradeNAK and the
C# method UpdateTradeACKNAKDB as defined below:
CREATE TABLE [tSWIFT_History_Trades](
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[BatchId] [varchar](25) NOT NULL,
[TradeId] [varchar](25) NOT NULL,
[Account] [varchar](25) ... 阅读全帖 |
|
p****1 发帖数: 275 | 4 【 以下文字转载自 JobHunting 讨论区 】
发信人: peace1 (peace1), 信区: JobHunting
标 题: C#, recruiter发过来的面试题
发信站: BBS 未名空间站 (Thu Sep 8 22:17:38 2016, 美东)
有兴趣做不? 我琢磨着, 出题的人是在寻找最优解 :)
Given the table [tSWIFT_History_Trades] , the C# structure TradeNAK and the
C# method UpdateTradeACKNAKDB as defined below:
CREATE TABLE [tSWIFT_History_Trades](
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[BatchId] [varchar](25) NOT NULL,
[TradeId] [varchar](25) NOT NULL,
[Account] [varchar](25) ... 阅读全帖 |
|
c**t 发帖数: 2744 | 5 SQL Server:
create proc prc_Test
@type varchar(20),
@validFrom datetime,
@validTo datetime
as
select blah from SomeTable where type=@type
and somedate between @validFrom and @validTo
exec 'blah blah', DateAdd(dd, -7, GetDate()), GetDate()
Server: Msg 170, Level 15, State 1, Line1
Line1: Incorrect syntax near 'dd'.
but the following statements are correct:
declare @d1 as datetime, @d2 as datetime
set @d1=DateAdd(dd, -7, GetDate())
set @d2=GetDate()
exec 'blah blah', @d1, @d2
what's wrong w |
|
i*****w 发帖数: 75 | 6 Try this:
--Last Week means SUNDAY - SATURDAY
declare @tbl table (name varchar(30), dt datetime )
insert into @tbl values('Apple', '2011/11/1')
insert into @tbl values('Apple', '2011/11/2')
insert into @tbl values('Apple', '2011/11/4')
insert into @tbl values('Orange', '2011/11/10')
insert into @tbl values('Orange', '2011/11/5')
insert into @tbl values('Apple', '2011/11/6')
insert into @tbl values('Banana', '2011/11/10')
SELECT NAME, COUNT(*) as Total_Count, SUM(case when dt between DATEADD(dd, ... 阅读全帖 |
|
y****9 发帖数: 144 | 7 Googled and tested for a while, comp up with this method:
select cast(datepart(yy, getdate()) as varchar) + '-' +
cast(datepart(mm, getdate()) as varchar) + '-' +
cast(datepart(dd, getdate()) as varchar) + ' ' +
cast(datepart(hh, getdate()) as varchar)
Not sure this is the best idea in SQL Server. in Oracle it is easy:
select to_char('YY-MM-DD HH24', sysdate) from dual;
any suggestion? I am working on a query which need this conversion
Thanks, |
|
c*********e 发帖数: 16335 | 8 造轮子的,可能也会漏过一些可能发生的情况。比如我朋友用的一个framework,在做
query时,order by里面的几个,它是用逗号来分开的,比如php的framework里面是这
么写的 explode(',',var)
如果order by里面用到了函数之类的比如date(x,getdate()),本身就有一个逗号在里面
,那explode(',',var)就会把date(x,getdate())拆分成2个date(x 和getdate())。这
样用这个framework写query,用到了order by date(x,getdate())的人就会发现出错信
息。 |
|
s*i 发帖数: 5025 | 9 Once you realize (month-end, friday) === (next day: month-start,
saturday), it becomes
trivial.
Javascrip code example:
var d = new Date(0);
while(d.getFullYear() < 3000) {
if(d.getDate() == 1 && d.getDay() == 6) {
//previous day must be a solution
d.setDate(d.getDate() - 1);
console.log(d);
//set the date back to current
d.setDate(d.getDate() + 1);
}
d.setDate(d.getDate() + 1);
} |
|
s*i 发帖数: 5025 | 10 Once you realize (month-end, friday) === (next day: month-start,
saturday), it becomes
trivial.
Javascrip code example:
var d = new Date(0);
while(d.getFullYear() < 3000) {
if(d.getDate() == 1 && d.getDay() == 6) {
//previous day must be a solution
d.setDate(d.getDate() - 1);
console.log(d);
//set the date back to current
d.setDate(d.getDate() + 1);
}
d.setDate(d.getDate() + 1);
} |
|
a9 发帖数: 21638 | 11 把getdate()替换成类似于
dateadd(dd,1- datepart(dw,convert(datetime,convert(varchar(4),getdate(),120)
+ '-01-01')),getdate()) |
|
b******g 发帖数: 3883 | 12 http://social.msdn.microsoft.com/Forums/sqlserver/en-US/bda433a
Steps:
1. Click on package properties. Set "DelayValidation" property to True.
The package will not validate tasks, connections, until they are executed.
2. Create a package level variable "XLFileRootDir" as string and set it to
the root
directory where you want the excel file to be created.
Example: C:\Project\Data\
3. Create an Excel connection in the connection manager. Browse to the
target directory
and select the destination XL... 阅读全帖 |
|
y***n 发帖数: 8 | 13 After you know what is CGI, now let us see what is CGI
program.
一个简单的例子
这里详细一步一步地解释所有有关发生的细节。
Display Date处是个指向CGI脚本的连接. 它的HTML是这样的:
http://www.popchina.com/cgi-bin/getdate">Display
the Date
说明是个CGI脚本是因为这里面有个cgi-bin的路径.
在许多服务器cgi-bin是仅能够放置CGI脚本的目录.
当你选择这个连接时, 你的浏览器将向www.popchina.com服务器提出
请求. 服务器接收这个请求计算出URL处的脚本文件名然后执行这个
脚本.
这个getdate脚本, 在UNIX系统中执行是这样的:
#!/bin/sh
echo Content-type: text/plain
echo
/bin/date
第一行是个特殊的命令,告诉UNIX系统这是个shell脚本; 真实的情
况是从这行开始的下一行,这个脚本做两件事:它输出行Content-ty
pe: t |
|
c**t 发帖数: 2744 | 14 declare @dt datetime
select @dt = getDate()
set @dt = getDate()
两句做的事情是一样的,这种情况下,他们有什么区别? |
|
g***l 发帖数: 18555 | 15 我找到了一个SCRIPT LOGIN的
USE master
GO
IF OBJECT_ID ('sp_hexadecimal') IS NOT NULL
DROP PROCEDURE sp_hexadecimal
GO
CREATE PROCEDURE sp_hexadecimal
@binvalue varbinary(256),
@hexvalue varchar (514) OUTPUT
AS
DECLARE @charvalue varchar (514)
DECLARE @i int
DECLARE @length int
DECLARE @hexstring char(16)
SELECT @charvalue = '0x'
SELECT @i = 1
SELECT @length = DATALENGTH (@binvalue)
SELECT @hexstring = '0123456789ABCDEF'
WHILE (@i <= @length)
BEGIN
DECLARE @tempint int
DECLARE @firstint in... 阅读全帖 |
|
y****9 发帖数: 144 | 16
then
then
Learning SQL server now :-) Based on your sql structure; the following
works in SQL Server 2005
WITH t(d,n)
AS ( SELECT getdate(), case when day(getdate())%3=0 then 1 else
0 end
UNION ALL
SELECT t.d+ 1, t.n + case when day(t.d +1)%3=0 then 1 else
0 end
FROM t
WHERE t.n < 10
)
select min(d) from t
group by n
order by 1;
-----------------------
2012-01-06 13:27:25.843
2012-01-09 13:27:25.... 阅读全帖 |
|
s**********o 发帖数: 14359 | 17 yyyy/mm/dd select convert(varchar, getdate(), 111)
yyyy.mm.dd select convert(varchar, getdate(), 102)
如果DOT不行,只能YEAR, MONTH, DAY了,还要补0 |
|
S**H 发帖数: 1256 | 18 set up a variable : currentFile ( string)
in the Execute SQL statement.
general
sourceType: Direct Input
SQL statement:
insert into dbo.logTable values
(@[User::CurrentFile],getdate(),getdate())
got error: the name is not permitted in this context. column name
not permitted.
Thanks a lot |
|
S**H 发帖数: 1256 | 19 Thanks!!!! It seems work now.
what I did
IN " Parameter Mapping"
new variable name: user::currentFile, ParameterName:0
type: varchar.
the sql code is like this now:
insert into dbo.logTable values
(?,getdate(),getdate())
*****************
Another Question:
If I have multiple varialbes needed to be passed.
How does the query know which ? is which ?
thanks !!!! |
|
s**m 发帖数: 1564 | 20 select substring(convert(char(23), getdate(), 120), 3,11)
select replace(substring(convert(char(23), getdate(), 120), 3,11), '-', '_')
[发表自未名空间手机版 - m.mitbbs.com] |
|
y********o 发帖数: 61 | 21 请问这个procedure干什么用的?sql 蝌蚪,读不懂啊~~求高人指点
USE [CFH_ODS]
GO
/****** Object: StoredProcedure [dbo].[DQ_VALIDATE] Script Date: 07/13/
2015 15:08:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[DQ_VALIDATE](@tableID bigint = null, @fldID bigint =
null)
AS
BEGIN
SET NOCOUNT ON
declare @VAL_ID bigint;
--
INSERT INTO DQ_VAL(VAL_START_DT) values(GETDATE());
SELECT @VAL_ID = @@IDENTITY;
DECLARE c CURSOR LOCAL STATIC READ_ONLY FORWARD_ONLY
... 阅读全帖 |
|
x****e 发帖数: 1773 | 22 USE [CFH_ODS]
GO
/****** Object: StoredProcedure [dbo].[DQ_VALIDATE] Script Date: 07/13/
2015 15:08:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[DQ_VALIDATE](@tableID bigint = null, @fldID bigint =
null) -- This proc takes @tablID and @fldID arguments.
-- No idea what this proc does without knowing about the procs it calls, and
all the tables that are involved in the whole process.
AS
BEGIN
SET NOCOUNT ON
declare @VAL_ID bigint; -- Declare an ... 阅读全帖 |
|
m******u 发帖数: 12400 | 23 这第二题。
我用cast(rand(datepart(millisecond, getdate())) as integer)
会出现许多同号的,而且,随机性并不好。比如我连续执行,出现的都是71,72,73什么
的,就是说,在一个很短的时间段内执行,结果也集中在某个值附近。
E.8.1
Create a batch that inserts 3000 rows in the employee table. The values of
the emp_no
column should be unique and between 1 and 3000. All values of the columns
emp_
lname, emp_fname, and dept_no should be set to 'Jane', ' Smith', and ' d1',
respectively.
E.8.2
Modify the batch E.8.1 so that the values of the emp_no column should be
generated
randomly us... 阅读全帖 |
|
|