Solved

how to automate generate scripts wizard MS SQL SEVER

Posted on 2010-08-25
4
868 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 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differeā€¦
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

726 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