sqlrd22 (12/18/2012)
Hi,I currently run a query daily and have to results going into a table using insert into.. select...
The problem is, this puts all the results of the query into the table again and I only wish for it to enter the results that are new as it is repeating the data that is already in the table.
Is there any type of append I can do that only adds records that are not currently in the table?
Sorry if this seems simple, still learning.
Thanks
Yes there is a way to do that. You have to add a where clause to your insert statement to filter out the data that is already there.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/