大家帮我看看 这存储过程  这个存储过程 出错的地方在“[poster]='+@poster+' 说是列名 @poster(变量) 无效。
而[poster]才是列名啊 倒是怎么会事情呢  我是原有的存储过程里改的只加了  [poster]="@poster"我是第一次搞存储过程
这个存储过程 这是一个写好了的存储过程 我修改的地方:
我加了个变量 @poster,nchar(20)
 让后在where加了个  [poster]=@poster 想让查询出来的[poster]里的值等于 变量@poster 
帮我把where里的判断写出来好吗  或者告诉我砸门改也行   在线等 谢谢 
CREATE PROCEDURE Wit_gettopiclistbytype2
@pagesize int,
@pageindex int,
@startnum int,
@poster,nchar(20),
@condition varchar(1000),
@ascdesc int
AS
DECLARE @strSQL varchar(5000)DECLARE @sorttype varchar(5)IF @ascdesc=0
   SET @sorttype='ASC'
ELSE
   SET @sorttype='DESC'IF @pageindex = 1
BEGIN
SET @strSQL = 'SELECT TOP ' + STR(@pagesize) +' [tid],[iconid],[typeid],[title],[price],[hide],[readperm],[poll],[poster],[posterid],[replies],[views],[postdatetime],[lastpost],[lastposter],[lastpostid],[lastposterid],[replies],[highlight],[digest],[displayorder],[attachment],[closed],[magic] FROM [Wit_topics] WHERE  [poster]!='+@poster+' and [displayorder]>=0' + @condition + ' ORDER BY [tid] '+@sorttype +',  [lastpostid] '+@sorttype
END
ELSE
BEGIN
IF @sorttype='DESC'
BEGIN
SET @strSQL = 'SELECT TOP ' + STR(@pagesize) +' [tid],[iconid],[typeid],[title],[price],[hide],[readperm],

[poll],[poster],[posterid],[replies],[views],[postdatetime],[lastpost],[lastposter],

[lastpostid],[lastposterid],[replies],[highlight],[digest],[displayorder],[attachment],[closed],[magic] FROM 

[Wit_topics] WHERE [lastpostid] < (SELECT min([lastpostid])  FROM (SELECT TOP ' + STR

((@pageindex-1)*@pagesize-@startnum) + ' [lastpostid] FROM [Wit_topics] WHERE  [displayorder]>=0' + @condition + ' ORDER BY [tid] ' + @sorttype + ' , [lastpostid] ' + @sorttype + ') AS tblTmp ) 

AND  [poster]='+@poster+' AND [displayorder]>=0' + @condition +'ORDER BY [tid] ' + @sorttype + ' ,  [lastpostid] ' + @sorttype
END
ELSE
BEGIN
SET @strSQL = 'SELECT TOP ' + STR(@pagesize) +' [tid],[iconid],[typeid],[title],[price],[hide],[readperm],

[poll],[poster],[posterid],[replies],[views],[postdatetime],[lastpost],[lastposter],

[lastpostid],[lastposterid],[replies],[highlight],[digest],[displayorder],[attachment],[closed],[magic] FROM 

[Wit_topics] WHERE [lastpostid] > (SELECT MAX([lastpostid])  FROM (SELECT TOP ' + STR

((@pageindex-1)*@pagesize-@startnum) + ' [lastpostid] FROM [Wit_topics] WHERE  [displayorder]>=0' + @condition + ' ORDER BY [tid] ' + @sorttype + ' , [lastpostid] ' + @sorttype + ') AS tblTmp ) 

AND [poster]!='+@poster+' and  [displayorder]>=0' + @condition +'ORDER BY [tid] ' + @sorttype + ' ,  [lastpostid] ' + @sorttype
END
END
EXEC(@strSQL)GO