?
Solved

how to automate generate scripts wizard MS SQL SEVER

Posted on 2010-08-25
4
Medium Priority
?
874 Views
Last Modified: 2012-05-10
as the title suggests, I want to take a backup of all scripts that are there in the Database (not the DATA, only scripts).
Now i know that this can be done through the Generate Scripts wizard.

I want to know, how can I automate this task. e.g. create it as a JOB that runs daily.

Thanks.
0
Comment
Question by:manivineet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 31

Expert Comment

by:James Murrell
ID: 33518740
0
 

Author Comment

by:manivineet
ID: 33519171
nope. I already explored that 1
Some better ideas please.
0
 
LVL 2

Accepted Solution

by:
marat-oz earned 1500 total points
ID: 33537736
In MS SQL Server 2000 you had an option to put Stored Procedure into separate file.
In SQL Server 2005 looks like you don't have this option, but you can script schema only without data itself.

Download bublishing Wizard if haven't installed it yet.
Execute the following
declare @cmd varchar(1000)
set @cmd = 'master.dbo.xp_cmdshell '
+          '''C:\"Program Files"\"Microsoft SQL Server"\90\Tools\Publishing\SqlPubWiz.exe script '
+          ' -d <database name>  -S <server name> -f -q -schemaonly <output directory>\'
+          '<database name>_'
+          convert(varchar(100), getdate(),112)
+          '.sql'''


exec (@cmd)
0
 

Author Closing Comment

by:manivineet
ID: 33680275
thnkx
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question