|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Friday, June 14, 2013 2:39 AM
Points: 49,
Visits: 187
|
|
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
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Thursday, June 13, 2013 7:03 AM
Points: 2,562,
Visits: 3,453
|
|
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
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Yesterday @ 8:44 PM
Points: 774,
Visits: 1,505
|
|
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.
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Yesterday @ 6:25 PM
Points: 198,
Visits: 657
|
|
| Certainly. Code repository systems work on this concept.
|
|
|
|