就在前面加@。
你看下你这个是否有错?
动态语句中两个单引为一个,所以得改成如下declare @email char(100) set @email='1028125449@qq.com'
declare @sql varchar(8000) set @sql='select top 5 * FROM Buy,User_Buy,GoodsType where Buy.BuyId=User_Buy.BuyId
and Buy.GoodsTypeId=GoodsType.GoodsTypeId and Buy.BuyId not in (select top '+cast((2-1)*5 as varchar(20))+
' Buy.BuyId FROM Buy,User_Buy,GoodsType where Buy.BuyId=User_Buy.BuyId and Buy.GoodsTypeId=GoodsType.GoodsTypeId
AND User_Buy.UserId=(select UserId from UserInfo where UserEmail='''+@email+''') order by BuyTime desc) and
User_Buy.UserId=(select UserId from UserInfo where UserEmail='''+@email+''') order by BuyTime desc ' exec(@sql)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)