时间:2021-07-01 10:21:17 帮助过:2人阅读
declare @sql nvarchar(2000)
declare @Sign_Count int
declare @tablename varchar(30)=‘SignUpSuccess.Record201605‘
DECLARE @IN_iUserDBID bigint=100051
DECLARE @IN_biSubMatchSerialNo varchar(255)=‘2016050403‘
set @sql=‘select @Sign_Count=count(1) from ‘+ @tablename +‘ where UserDBID=‘+convert(varchar(255),@IN_iUserDBID)+‘ and MatchSerialNo=‘+convert(varchar(255),@IN_biSubMatchSerialNo)+‘ and convert(date,QuitTime)=convert(date,getdate())‘
--select @sql
exec sp_executesql @sql, N‘@Sign_Count int out ‘, @Sign_Count out
动态sql
标签: