插入到,即使是空白
Insert Into, even if blank
我要查看过去 18 小时内是否收到过文件。
在同一个 table 中,检查始终生成文件的位置。这个特定的文件并不总是进来。
我想做的是有一个 IF/ELSE 这样如果不满足条件,仍然会生成该字段来告诉用户文件不存在,而不是只是没有记录.
DECLARE @BASE varchar(55) = 'BASE5_017_%'
INSERT INTO @TranTable(Inbound,BatchID,Filename,FileDateTime,TotalCount,IsValid)
select top 1 'BASE', BatchID,Filename,FileDateTime,TotalCount,IsValid from TranBatchFile (nolock)
where Filename like @BASE AND FileDateTime >= DATEADD(HH,@TimeD,@Now) order by 1 desc
这就是我的。我喜欢的是:
Insert into ....
If this check comes back with something
show the something
else
"nothing here champ, find out what went wrong"
保持 Inbound 字段不变,但其余部分为空,也许 Filename
字段说明找出问题所在
这是您要找的吗?
insert into test
select id, col2 from test where id = 2
IF @@ROWCOUNT = 0
insert into test values(2, 'B')
我要查看过去 18 小时内是否收到过文件。 在同一个 table 中,检查始终生成文件的位置。这个特定的文件并不总是进来。
我想做的是有一个 IF/ELSE 这样如果不满足条件,仍然会生成该字段来告诉用户文件不存在,而不是只是没有记录.
DECLARE @BASE varchar(55) = 'BASE5_017_%'
INSERT INTO @TranTable(Inbound,BatchID,Filename,FileDateTime,TotalCount,IsValid)
select top 1 'BASE', BatchID,Filename,FileDateTime,TotalCount,IsValid from TranBatchFile (nolock)
where Filename like @BASE AND FileDateTime >= DATEADD(HH,@TimeD,@Now) order by 1 desc
这就是我的。我喜欢的是:
Insert into ....
If this check comes back with something
show the something
else
"nothing here champ, find out what went wrong"
保持 Inbound 字段不变,但其余部分为空,也许 Filename
字段说明找出问题所在
这是您要找的吗?
insert into test
select id, col2 from test where id = 2
IF @@ROWCOUNT = 0
insert into test values(2, 'B')