Iam using "exec Sp_generate_inserts 'tablename'" to generate insert script to tables. It is generating insert scripts sucessfully for all tables except one which is having 120 columns.Any solution for this??
quote:NOTE: This procedure may not work with tables with too many columns. Results can be unpredictable with huge text columns or SQL Server 2000's sql_variant data types Whenever possible, Use @include_column_list parameter to ommit column list in the INSERT statement, for better results IMPORTANT: This procedure is not tested with internation data (Extended characters or Unicode). If needed you might want to convert the datatypes of character variables in this procedure to their respective unicode counterparts like nchar and nvarchar
The script documents the ability to specify column to include or to exclude when generating the insert statements.
I've never used the script; however, reviewing the script's coding it looks as though there is no work around other than generating an INSERT with fewer columns. Maybe you can exclude columns where most results are NULL and manually create an update statement to follow the generated INSERT statement adding in the data from the missing columns?
A little more indepth analysis shows if you were to change two decleration variables "@Column_List" and "@Actual_Values" from being VARCHAR(8000) to VARCHAR(MAX) then you can get by the column length limitation....again, this is assuming you are using the script mentioned in my previous response.