Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Generate script for all objects in a database


Generate script for all objects in a database

Author
Message
Prabhu Rajamani
Prabhu Rajamani
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 10
There is one SP (SP_GenerateScript) available at the below URL:

http://www.databasejournal.com/features/mssql/article.php/10894_3401081_1/Automating-Generate-SQL-Script.htm


Explanation for the switches in the SP can be found at the below URL:

http://www.sqlservercentral.com/articles/Administration/howtoscheduleasqlserverdatabasecreationscript/1834/

When i execute the SP script files are created successfully. Separate script files each for Table, SP, Views, etc are created. But my requirement is to create a single file for all objects.

There is an occurence in the SP like
set @query = '"'+@applicationpath +'"'+ ' /s '+@@servername+ ' /d '+@dbname+ +' /F '+@destinationpath+ @switches

As per the explanation in the Switches, /F means separate file for different category of objects.

Hence is replaced /F with /f, which means all script in a single file. Now i get an error like the one below:

Scripting failed.
ERROR: Executing ScriptTransfer
Error Code: 5
Error Category: 0
Source: Microsoft SQL-DMO
Description: [SQL-DMO]CreateFile error on 'd:\pubs20100108'. Access is denied.
NULL
NULL

Can anyone help me out on how to resolve this?
Garadin
Garadin
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1771 Visits: 4107
Looks like a permissions issue to me. Is the directory/user/etc you used when the script executed successfully the same as the ones you used when it failed?

Seth Phelabaum
Consistency is only a virtue if you're not a screwup. ;-)

Links: How to Post Sample Data :: Running Totals :: Tally Table :: Cross Tabs/Pivots :: String Concatenation
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search