declare @ varchar(8000) set @='select * from 表 where a in('+'244,242'+')' exec(@)
CREATE proc Delete_topics @topicids varchar(1000) as declare @topicids varchar(2000) insert into whiteforum.forum_topics_backup SELECT forum_id, t_status, t_date, t_subject, t_message, t_author, t_reply_count, t_view_count, t_last_post, t_last_author, t_ip, t_level, t_property, t_place, save_validity, delete_time, receive_emp, worning_emp, view_emp, receive_cemp, limit_count, limit_datetime, limit_viewemp FROM dbo.View_Delete where topic_id in (@topicids) insert into whiteforum.forum_reply select topic_id, r_author, r_message, r_date, r_ip, view_emp from whiteforum.forum_reply where topic_id in (@topicids) delete from whiteforum.forum_topics where topic_id in (@topicids) delete from whiteforum.forum_reply where topic_id in (@topicids) GO 这是我做的存储过程,我想在前台传这样类型的参数(1,2,3),我要怎么改,你说的方法不行
CREATE proc Delete_topics @topicids varchar(1000) as declare @sql varchar(8000)set @sql='insert into whiteforum.forum_topics_backup SELECT forum_id, t_status, t_date, t_subject, t_message, t_author, t_reply_count, t_view_count, t_last_post, t_last_author, t_ip, t_level, t_property, t_place, save_validity, delete_time, receive_emp, worning_emp, view_emp, receive_cemp, limit_count, limit_datetime, limit_viewemp FROM dbo.View_Delete where topic_id in ('+@topicids+') insert into whiteforum.forum_reply select topic_id, r_author, r_message, r_date, r_ip, view_emp from whiteforum.forum_reply where topic_id in ('+@topicids+') delete from whiteforum.forum_topics where topic_id in ('+@topicids+') delete from whiteforum.forum_reply where topic_id in ('+@topicids+')' exec(@sql) GO
set @='select * from 表 where a in('+'244,242'+')'
exec(@)
declare @topicids varchar(2000)
insert into whiteforum.forum_topics_backup SELECT forum_id, t_status, t_date, t_subject, t_message, t_author, t_reply_count,
t_view_count, t_last_post, t_last_author, t_ip, t_level, t_property, t_place,
save_validity, delete_time, receive_emp, worning_emp, view_emp, receive_cemp,
limit_count, limit_datetime, limit_viewemp
FROM dbo.View_Delete where topic_id in (@topicids)
insert into whiteforum.forum_reply select topic_id, r_author, r_message, r_date, r_ip, view_emp from whiteforum.forum_reply where topic_id in (@topicids)
delete from whiteforum.forum_topics where topic_id in (@topicids)
delete from whiteforum.forum_reply where topic_id in (@topicids)
GO
这是我做的存储过程,我想在前台传这样类型的参数(1,2,3),我要怎么改,你说的方法不行
declare @sql varchar(8000)set @sql='insert into whiteforum.forum_topics_backup SELECT forum_id, t_status, t_date, t_subject, t_message, t_author, t_reply_count,
t_view_count, t_last_post, t_last_author, t_ip, t_level, t_property, t_place,
save_validity, delete_time, receive_emp, worning_emp, view_emp, receive_cemp,
limit_count, limit_datetime, limit_viewemp
FROM dbo.View_Delete where topic_id in ('+@topicids+')
insert into whiteforum.forum_reply select topic_id, r_author, r_message, r_date, r_ip, view_emp from whiteforum.forum_reply where topic_id in ('+@topicids+')
delete from whiteforum.forum_topics where topic_id in ('+@topicids+')
delete from whiteforum.forum_reply where topic_id in ('+@topicids+')'
exec(@sql)
GO