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
Solved

how to automate generate scripts wizard MS SQL SEVER

Posted on 2010-08-25
4
850 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
  • 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

860 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