我想创建一个过程,该过程应检查两个表之间的列,并根据比较将值插入另一个表中。如何比较两个表的列并根据SQL Server中存储过程中的比较将值插入新表中
表1:
create table table1
(
ID int not null primary key,
)
表2:
Create table table2
(
ItemID int not null primary key,
ID int FOREIGN KEY REFERENCES Orders(OrderID) ,
Descp Text
)
表3:
create table table3
(
ID int,
ItemCheck char
)
值的表3的列应该与表1的ID
列和 相同,如果table1表的ID
列存在于表2中,则表3的值列ItemCheck
应该是'true'oterwise'false'。 请给我一些想法,并让我知道如果你有任何疑问。提前致谢。
It Works。非常感谢你 – Ats 2015-02-24 18:16:51