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.
Author |
Topic |
dkekesi
Starting Member
38 Posts |
Posted - 2012-12-12 : 04:48:58
|
Hi All,I need to generate data insert scripts for tables in a database but only for tables whose name begin with 'Enum'. I have hundreds of tables full of data, but only about a dozen Enum tables that contain static data, hence I want to filter for the name.Any type of solution is OK with me using CLR, TSQL, C#.Thanks a lot in advance.Best Regards,Daniel |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2012-12-12 : 05:04:41
|
This is an sp which takes a table name and creates insert statements for the data.http://www.nigelrivett.net/SQLTsql/sp_CreateDataLoadScript.htmlIt's very old so may need some tweaking for current versions.Create a temp table and populate it with the names of tables you require.Loop through that calling the above sp for each table.You can insert the output of the sp into a temp table if you want to concatenate all the rows.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
dkekesi
Starting Member
38 Posts |
|
|
|
|