Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

about storing sql script in a table? Expand / Collapse
Author
Message
Posted Sunday, January 27, 2013 10:14 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Yesterday @ 8:38 AM
Points: 45, Visits: 168
Hi


Can i store the database creation script in a table call the script in stored procedure to create new database with tables and stored procedure
can any one give me idea about this

thanks

with best regards
pradeep
Post #1412176
Posted Monday, January 28, 2013 4:03 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, March 26, 2013 8:41 AM
Points: 2,562, Visits: 3,451
mpradeep23 (1/27/2013)
Can i store the database creation script in a table call the script in stored procedure to create new database with tables and stored procedure
Yes this can be done but if you rather create .sql files and then call them with the help of sqlcmd then that will be much simpler and easy to troubleshoot


-------Bhuvnesh----------
While 1 = 1 (Learning SQL....)
Click to get fast response of your post
Post #1412322
Posted Tuesday, January 29, 2013 8:09 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Yesterday @ 6:54 PM
Points: 721, Visits: 1,375
mpradeep23 (1/27/2013)
Hi


Can i store the database creation script in a table call the script in stored procedure to create new database with tables and stored procedure
can any one give me idea about this

thanks

with best regards
pradeep


Yes, but you will have to use dynamic SQL to actually execute scripts stored in a table as character strings. Set a variable of datatype (n)varchar with adequate scale equal to the result of the SELECT statement that returns the query you want, then run the sp_executesql system stored procedure with that variable as the input parameter value.
Post #1413068
Posted Thursday, April 11, 2013 4:38 PM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, May 17, 2013 4:43 PM
Points: 192, Visits: 640
Certainly. Code repository systems work on this concept.
Post #1441516
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse