SQL Server 2005
create procedure proc_restaurantinfo@pagesize int ,@currentpage int
as
declare @sql nvarchar(1000)
set @sql='select top '+Cast(@pagesize as varchar(30))+' * from Restaurantinfo where (restaurantid not in(select top '+Cast((@currentpage-1)*@pagesize as varchar(30))+' restaurantid from restaurantinfo order by restaurantid))and Provinceid=(select ProvinceId from ProvinceInfo where Province='+Cast("Sydney" as varchar(30))+')'
exec sp_executesql @sql
go
执行时,提示错误:
消息 207,级别 16,状态 1,过程 proc_restaurantinfo,第 12 行
列名 'Sydney' 无效
请各位大侠指点! --------------------编程问答-------------------- 列名 'Sydney' 看看是否存在 --------------------编程问答-------------------- 象这样拼出来的语句先用print(@sql)输出来看下, --------------------编程问答-------------------- 数据库是否当前的楼主想要的数据库
补充:.NET技术 , ASP.NET