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
 Analysis Server and Reporting Services (2005)
 Insert not duplicate data

Author  Topic 

Zul
Starting Member

17 Posts

Posted - 2009-06-25 : 07:29:01
hi all
i want to ask again.
how can i insert data from db master to db client if in db master there have duplicate data?
can we use no exists?
can you show me the query??

Regrads

Zul

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-25 : 08:20:10
INSERT TargetTable (Co1, Col2, ... )
SELECT DISTINCT s.Col1, s.Col2, ...
FROM SourceTable AS s
WHERE NOT EXISTS (SELECT * FROM TargetTable AS t WHERE t.pkCol = s.pkCol)



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -