sp_executesql问题,求帮忙(在线等,给分)
本帖最后由 yo_you920821 于 2013-11-28 16:03:05 编辑
exec sp_executesql N'SELECT A.* FROM (SELECT *,ROW_NUMBER() over (ORDER BY Id DESC) as ROWNUM FROM (
SELECT * FROM App_Attachment_TD T1 WHERE 0=0 AND T1.ID IN @IDS AND 0=0 AND 0=0
) B) A WHERE ROWNUM BETWEEN @ROWSTART AND @ROWEND',N'@IDS nvarchar(10),@ROWSTART int,@ROWEND int',@IDS=N'(24,25)',@ROWSTART=1,@ROWEND=2147483647
exec sp_executesql N'SELECT A.* FROM (SELECT *,ROW_NUMBER() over (ORDER BY Id DESC) as ROWNUM FROM (
SELECT * FROM App_Attachment_TD T1 WHERE 0=0 AND T1.ID IN '+@IDS+' AND 0=0 AND 0=0
) B) A WHERE ROWNUM BETWEEN @ROWSTART AND @ROWEND',
N'@IDS nvarchar(20),@ROWSTART int,@ROWEND int',@IDS=N'(24,25)',@ROWSTART=1,@ROWEND=2147483647
exec sp_executesql N'SELECT A.* FROM (SELECT *,ROW_NUMBER() over (ORDER BY Id DESC) as ROWNUM FROM (
SELECT * FROM App_Attachment_TD T1 WHERE 0=0 AND charindex('',''+cast(T1.ID as varchar)+'','', '',''+@IDS+'','') AND 0=0 AND 0=0
) B) A WHERE ROWNUM BETWEEN @ROWSTART AND @ROWEND',N'@IDS nvarchar(10),@ROWSTART int,@ROWEND int',@IDS=N'''24'',''25''',@ROWSTART=1,@ROWEND=2147483647