Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to automate generate scripts wizard MS SQL SEVER

Posted on 2010-08-25
4
Medium Priority
?
882 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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

604 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