Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
junior6202
Starting Member
45 Posts |
Posted - 2015-02-02 : 22:17:51
|
I have a question, I have to add a step into a SQL job agent which needs to be a insert statement to a table from another table. The insert statement is not the issue as you can see below. The purpose of this insert statement is to update table dbo.INV_Items with any new item numbers added to dbo.PartInfo table. I guess my question is is it just a insert statement or do i require a special function. Please let me know what you think. insert into [dbo].[INV_Items](ITEMNMBR) select [Item] as ITEMNMBR FROM [dbo].[PartInfo] |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2015-02-03 : 07:08:27
|
you do not need a special function. You can simply add a tsql set to the Asian shop containing your INSERT statement. |
|
|
junior6202
Starting Member
45 Posts |
Posted - 2015-02-03 : 13:12:39
|
How do i check if the data already exists and if does only insert data that does not exist. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2015-02-03 : 13:51:27
|
Here's an example:insert into table2 (...)select * from table1where not exists (select * from table2 where table1.pkcolumn = table2.pkcolumn)Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|