如何在两个表中存储相同的值? [英] how to store a same values in two tables?
本文介绍了如何在两个表中存储相同的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您能否说出如何在注册时将相同的值存储到不同的表中?...
can u say how to store the same values to different tables at a register time...
推荐答案
例如,您将empid插入到两个表中然后像这样写存储过程
创建过程emp_id(@id int)as
开始
插入表_1(empid)值(@id)
去
插入table_2(empid),values(@id)
结束
for example u inserting empid to two tables then write store procedure like
create procedure emp_id(@id int)as
begin
insert into table_1(empid) values(@id)
go
insert into table_2(empid),values(@id)
end
declare @Amount decimal(18,2)
set @Amount
insert into Table1(Amount)
select @Amount
insert into Table2(Amount)
select @Amount
这将有所帮助,
http://stackoverflow.com/Questions/3712678/how-can-i-insert-data-into-two-tables-simultaneously-in-sql-server [
This will help,
http://stackoverflow.com/questions/3712678/how-can-i-insert-data-into-two-tables-simultaneously-in-sql-server[^]
这篇关于如何在两个表中存储相同的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文