本文介绍了在两个表中发送相同的序列号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我叫faiz.我的代码遇到问题,请帮助我
问题是我有两个表,而字段是
Hi my name is faiz I have been facing a problem in my codes please help me
Problem is I have two tables and fields are
Table1
1 2 3 4
Id(guid) Name serial No(guid or string) Price
Table2
1 2 3 4
Id(guid) name serial No location
当我在表1中插入数据时,我希望在表2序列号中使用相同的序列号.
SQL查询将如何以及如何在代码中实现.请帮助我
When i insert data in table1 so I want the same serial number would go in table2 serial number.
How will be the SQL Query and how i will implement in our code .please help me
推荐答案
CREATE PROCEDURE sp_InsertSerialNumber
(
@Id UniqueIdentifier ,
@Name NVARCHAR(255),
@SerialNo NVARCHAR(255),
@Price BigInt ,
@Location NVARCHAR(255)
)
AS
BEGIN
INSERT INTO Table1
SELECT @Id,@Name,@SerialNo,@Price
INSERT INTO Table2
SELECT @Id,@Name, @SerialNo,@Location
END
希望对您有帮助
--Rahul
Hope this help
--Rahul
这篇关于在两个表中发送相同的序列号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!