create proc sp_import @str nvarchar(1), @col nvarchar(1) as begin insert into tb(@col) select @str end
我知道上面这么写是错的,除了@sql写个拼合语句外,还有其他方法吗?谢谢
------解决方案--------------------
SQL code
create proc sp_import
@str nvarchar(1),
@col nvarchar(1)
as
begin
exec('insert into tb('+@col+')
select @str')
end
------解决方案--------------------
------解决方案--------------------
SQL code
create proc sp_import
@str nvarchar(1),
@col nvarchar(1)
as
begin
exec('insert into tb('+@col+')
select ‘+@str)
end
------解决方案-------------------- create proc sp_import @str nvarchar(1), @col nvarchar(1) as begin exec('insert into tb('+@col+') select '+@str) end
------解决方案--------------------