From: Plamen Ratchev on 29 Mar 2010 10:58 Andy B. wrote: > 1. Select all rows that exist both in the TVP @Headlines and in the table > [Headlines].[Headlines] and insert them into a table variable > @ExistingHeadlines. INSERT INTO @ExistingHeadlines (<columns>) SELECT <columns> FROM @Headlines INTERSECT SELECT <columns> FROM [Headlines].[Headlines]; > 2. Select the rows that exist only in the TVP @Headlines and not in > [Headlines].[Headlines] and insert them into a table variable > @NonexistentHeadlines. > INSERT INTO @NonexistentHeadlines (<columns>) SELECT <columns> FROM @Headlines EXCEPT SELECT <columns> FROM [Headlines].[Headlines]; -- Plamen Ratchev http://www.SQLStudio.com
|
Pages: 1 Prev: Remote Access Steps Next: Need help with a stored procedure |