x

Generating script for a table using command line

How to generate script(also want to save) for a table using command line.I want to connect to sql server through command line.Can i create a procedure and invoke from command line? help me.thanks in advance.

more ▼

asked Apr 28, 2010 at 05:18 AM in Default

avatar image

venkatreddy
562 29 31 36

(comments are locked)
10|1200 characters needed characters left

3 answers: sort voted first

you can execute SQL statements from the command line using the osql utility. http://msdn.microsoft.com/en-us/library/aa213090%28SQL.80%29.aspx

more ▼

answered Apr 28, 2010 at 05:30 AM

avatar image

Fatherjack ♦♦
43.7k 79 97 117

(comments are locked)
10|1200 characters needed characters left

The two ways that come to mind both involve using SMO. One way would be to use Powershell to fire it off, and the other would be two write a C# application to do it.

But, effectively, there would be very little difference between the two approaches.

more ▼

answered Apr 28, 2010 at 05:31 AM

avatar image

Matt Whitfield ♦♦
29.5k 62 66 88

(comments are locked)
10|1200 characters needed characters left

There is publishing wizard which can be executed from command line. There is good article on this, I just tried it.

http://blog.sqlauthority.com/2007/11/16/sql-server-2005-generate-script-with-data-from-database-database-publishing-wizard/

more ▼

answered Apr 28, 2010 at 10:56 AM

avatar image

Bhaskar
333 17 19 24

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x1065
x21
x8

asked: Apr 28, 2010 at 05:18 AM

Seen: 4262 times

Last Updated: Apr 28, 2010 at 05:18 AM

Copyright 2016 Redgate Software. Privacy Policy