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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 DTS Moving Data Between Databases using a Conditio

Author  Topic 

MrSingh
Starting Member

5 Posts

Posted - 2011-03-14 : 10:27:04
Hi, I am fairly new to databases and need a hand moving data from a staging to a live table. Schema is identical between the databases but content is different.

I am trying to run the following using SQL Server 2005 DTS however it is falling over at line 2 incorrect syntax error. Could you please take a look and advise of a resolutions? All comments are welcome, thank you.

Databases
Live = Test_Live
Staging Test_Staging

Table
Tool

Cloumn
ToolCode

INSERT INTO Test_Live.Tool
FROM Test_Staging.Tool
WHERE Test_Staging.Tool.ToolCode NOT IN Test_Live.Tool.ToolCode

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2011-03-14 : 15:03:52
--Your method.
INSERT INTO Test_Live.Tool
Select ToolCode
FROM Test_Staging.Tool
WHERE Test_Staging.Tool.ToolCode NOT IN (select ToolCode from Test_Live.Tool)

--Another method

INSERT INTO Test_Live.Tool
Select ToolCode
FROM Test_Staging.Tool TOut
WHERE Not Exists (Select 1 from Test_Live.Tool Tin where Tout.ToolCode = Tin.ToolCode )

Note:I have not carried out any testing.
Go to Top of Page
   

- Advertisement -