[code=SQL][/code]
alter procedure tiaoshi
@tablename nvarchar(80),
@rowindex nvarchar(8)
as
declare @sql varchar(8000)
set @sql='declare @order table(sequence int, uut nvarchar(8) null) insert into @order select sequence [email protected]+'insert into @order values(' [email protected]+ ',null) select * from @order order by sequence'
exec(@sql)
return
报错,显示输入参数不符合定义,我希望达到的目的是列uut输入为空值,尝试过将列的默认值设置为空,插入一个参数,结果也是报错,显示参数个数不对,希望高手指点
------解决方案--------------------
- SQL code
--alter procedure tiaoshi declare @tablename nvarchar(80) declare @rowindex nvarchar(8)--as declare @sql varchar(8000) set @sql='declare @order table(sequence int, uut nvarchar(8) null) insert into @order --这个地方添加上列名sequence insert into @order select sequence [email protected]+' insert into @order values(' [email protected]+ ',null) --允许null的列,可以不写 values(' [email protected]+ ') select * from @order order by sequence' print @sql --拼接后的字符串,LZ最好print出来看看 --exec(@sql) --return