| Author |
Topic  |
|
|
arthiasha
Starting Member
India
40 Posts |
Posted - 10/09/2012 : 01:51:46
|
Hi,
I need to create a batch file with the scripts which is in .sql format. table_schema.sql stored procedures.sql uddtypes.sql uddtables.sql grant permission.sql sql injection.sql users.sql
These files hold all scripts for creation of schema, stored procedures, users, uddt's etc I need to create a single batch file so that when i run it, automatically the schema with stored procedures and everything should be created in my mssql 2008.
create table..... (execute 'table_schema') create table.....(execute 'stored procedures') .... ...
it should be given like this can u give me the script? |
|
|
sunitabeck
Flowing Fount of Yak Knowledge
5152 Posts |
Posted - 10/09/2012 : 07:05:45
|
In SQL Server Management Studio, in object explorer, right-click on the database name and select Tasks -> Generate Scripts and follow through the wizard.
If you are trying to port a database from one server to another, there are other ways as well - backup and restore, SSIS etc. |
 |
|
|
arthiasha
Starting Member
India
40 Posts |
Posted - 10/09/2012 : 07:46:58
|
Thanks for your relpy, but i dont want to do this way because i need to use this as a deploy script to create a new database with its schema etc..as well as bcp it.
I wanted a script like create database [dbname] ... (call all the .sql scripts-table schema,procedures etc .... ....
so that it creates the whole database with its schema procedure uudtypes etc. |
 |
|
|
sunitabeck
Flowing Fount of Yak Knowledge
5152 Posts |
Posted - 10/09/2012 : 07:55:28
|
I am afraid I did not follow the requirement.
If you are trying to create a database with all the schema objects and none of the data, what I described above would work. You will generate the scripts once (which is a manual process), and then use that script to create your deployment package/script.
You also mentioned BCP. If you are trying to deploy the database with the data, backup and restore may be a better option. That also can be scripted. |
 |
|
| |
Topic  |
|