You would use this script if you wanted a regular version of table data creating into its own table, if you wanted to track changes etc. Firstly, set your first 3 variables: @DatabaseName, @SchemaName, @SelectFromTableName VARCHAR Variables wtih the relevant values. There are already values in here, so change them to what you want them to be. To set this to run on a regular basis, you might want to paste this code in a stored procedure and schedule it on a SQL Agent Job. A possible way to extend this script is to add a where clause to the select statement, so that you are only selecting the data where a date field in the table is for current day. Please contact if you have any comments or suggestions
How to Design, Build and Test a Dynamic Search Stored Procedure
Learn how to design, build and test a dynamic search SP in just a few simple but methodical steps.
2015-03-06 (first published: 2013-11-05)
24,466 reads