sql 语句错误,请大哥大姐们帮忙看一下
DECLARE @name varchar(50)
DECLARE @smsCount int
DECLARE @DataString datetime
DECLARE @s nvarchar(200)
set @DataString = getdate()-3
set @name='资料40000'
if EXISTS(select TABLE_Name from information_schema.tables where TABLE_Name='temp')
begin
drop table temp
end
set @s='SELECT * into temp FROM '+ @name +' where datediff(d,'''+ cast(@DataString as nvarchar(25))+''',日期)=0'
exec(@s)
-- print @s
--select * from temp
set @smsCount=(select * from temp)
print @smsCount
--------------------------------------------
错误提示
消息 116,级别 16,状态 1,第 23 行
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.