日期:2014-05-17 浏览次数:20490 次
DECLARE @sql nvarchar(max),
@xxxxx int ,
@Pdate varchar(100)
set @Pdate=1308
set @xxxxx=( select count(id) from [1308] )
--这里正常
SET @sql = N'
SET @xxxxx=(select count(id) from '+QUOTENAME(@Pdate) +' )
'
EXEC sp_executesql @sql
PRINT @xxxxx
DECLARE @sql nvarchar(max),
@xxxxx int ,
@Pdate varchar(100)
set @Pdate=1308
set @xxxxx=( select count(id) from [1308] )
--这里正常
SET @sql = N'SET @xxxxx=(select count(id) from '+QUOTENAME(@Pdate) +')'
EXEC sp_executesql @sql ,N'@xxxxx int output',@xxxxx=@xxxxx output
PRINT @xxxxx
DECLARE @sql nvarchar(max),
@xxxxx int ,
@Pdate varchar(100)
set @Pdate='1308'
set @xxxxx=( select count(id) from [1308] )
--这里正常
SET @sql = N'DECLARE @xxxxx int;
SET @xxxxx=(select count(id) from '+QUOTENAME(@Pdate) +' )
'
EXEC sp_executesql @sql
PRINT @xxxxx