备注 | 修改日期 | 修改人 |
其他原因... | 2021-11-04 14:54:39[当前版本] | 系统管理员 |
其他原因... | 2021-11-04 14:42:08 | 系统管理员 |
CREAT | 2021-10-29 14:15:47 | 系统管理员 |
alter proc testpapers
as
begin
declare @tems
nvarchar(max),@zidaun nvarchar(max)
set @tems=select * from
@tems order by @zidaun
exec(@tems)
end
exec
testpapers
消息 156,级别 15,状态 1,过程 testpapers,第 1 行
关键字
'select' 附近有语法错误。
消息 1087,级别 15,状态 2,过程 testpapers,第 1 行
必须声明表变量 "@tems"。
alter proc testpapers
as
begin
declare
@startRow nvarchar(max),@tems nvarchar(max),@zidaun
nvarchar(max)
set @startRow='temp'
set
@tems='select * from ';
set @zidaun='p_id';
exec(@tems+@startRow+' order by '+@zidaun)
end
exec testpapers