Execute Database script generated by MS SQL Server

Firstly, script your database tables with Sql Server Management studio.

Then in your script, remove descriptive headers, SET ANSI_NULL, SET QUOTED_IDENTIFIER and GO. These things are used by Query Designer in SSMS.

Secondly, you can run your script with SqlCommand.ExecuteNonQuery() without any problem.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s