悬赏园豆:10
[已关闭问题]
<P>我建了个存储过程</P>
<P>if exists(select * from sysobjects where name='Proc_GetSnm_announcementByTopSize')<BR> drop proc Proc_GetSnm_announcementByTopSize<BR>go<BR>create proc Proc_GetSnm_announcementByTopSize<BR> @size int<BR>as<BR>declare @sql nvarchar(4000)<BR> if(@size=0)<BR> begin <BR> select top (select count(*) from snm_announcement) snm_announcement.*,snm_user.username <BR> from snm_announcement,snm_user <BR> where snm_announcement.uid=snm_user.uid <BR> order by pubdate desc<BR> end<BR> else select top @size) snm_announcement.*,snm_user.username <BR> from snm_announcement,snm_user <BR> where snm_announcement.uid=snm_user.uid <BR> order by pubdate desc'<BR> exec sp_executesql @sql<BR>go</P>
<P>老是报错 </P>
<P>@size 附近有语法错误 </P>
<P>这是怎么回事啊?</P>