New answers tagged temp-tables
If you are going to make a new entry means, You can just do Insert into tablename select query If you want to update your table based on some values, but the values are need to took from some other table through joining(Select query which you mentioned)you can store those values in temp table.And then you can iterate those values through do-while or ...
You can indeed use stored procedures to refresh the data in your database. It just means coding the INSERTs and UPDATEs appropriate to your data. If you are replacing the existing data with new data, you could use: INSERT INTO ... SELECT FROM ... syntax, after deleting the existing data, to pull the data from your query and insert it into the now empty ...
Based on your 2nd code snippet in the question, if the table already exists by the time you get to the sp_executesql, then you didn't need a global temporary table (##table) to begin with: a local temporary table (#table) would work just fine. Local temporary tables are available to sub-processes, and any changes made to them (data and/or schema) are ...
I used Mark Sinkinsons suggestion and used a real table with a GUID field for distinction between data. ** Using @srutzky answer worked much cleaner, while both answers worked @srutzky 's answer was more efficient.
Top 50 recent answers are included