我只想加个参数回去。该怎么写?
@diruser nvarchar(30)
......
as
declare @sql nvarchar(255)
set @sql = 'select top ' + cast(@pages as nvarchar(10)) + ' @id = ID from table where diruser = @diruser '
(上句@diruser这里出错!)
...
go
我只想加个参数回去。
该怎么写?
------解决方案----------------------try
declare @diruser nvarchar(30)
......
as
declare @sql nvarchar(255)
set @sql = 'select top ' + cast(@pages as nvarchar(10)) + ' ID from table where diruser = ' ' '+@diruser+ ' ' ' '
...
go
------解决方案--------------------set @sql = 'select top ' + cast(@pages as nvarchar(10)) + ' '+ rtrim(str(@id)) + ' from table where diruser = ' ' '+ cast(@diruser as nvarchar(10)) + ' ' ' '
不知道行不行,请楼下鉴定一下