请教各位高手,关于sqlserver存储过程的问题

2024-12-20 09:35:17
推荐回答(1个)
回答1:

create procedure atob
(
@type varchar(50)
)
as
declare @sql varchar(1000)
set @sql='
insert into b(id)
select id
from A
where 1=1'
if @type <>''
set @sql =@sql +' and a.type='''+@type+''''
exec(@sql)