Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 db scripts

Author  Topic 

Arun.G
Yak Posting Veteran

81 Posts

Posted - 2010-07-11 : 23:59:21
How to make complete db script which will execute all the tables created in database,and functions,a dn stored procedures in the db.


I have one database, cwhich contains, tables,functions,stored procedures,

if i execute one script means, it should executed all the tables,function,views,sps created in the db.


how should i do that in sqlserver 2008?

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2010-07-12 : 01:16:03
right click on database choose task and then select 'Generate Scripts' I think that will do it

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page

Arun.G
Yak Posting Veteran

81 Posts

Posted - 2010-07-12 : 04:24:25
YA I KNOW THAT, BUT IT WILL GIVE ONLY CREATE TABLES NOT RECORDS

I WANT RECORDS ALSO, IS IT POSSIBLE?

USING RESOTRE DATABASE V CAN DO THAT,BUT IT CAN BE APPLIED,ONLY IF ALREADY ONE DB IS THER MEANS V CAN RESTORE THE DB AND MAKE SOMEOTHER NEW DB AS SAME AS LIKE THAT.

BUT I WANT TO CREATE A DATABASE FOR FIRST TIME IN MY PERSONAL SYSTEM AS SAME AS MY OFFICE DATABASE MEANS,

I NEED ALL THE TABLES WITH RECORDS, SO I NEED SCRIPTS WHICH CONTAINS CREATE SCRIPTS AS WELL AS INSERT INTO SCRIPTS.

CAN V SEPERATELY TAKE INSERT INTO SCRIPTS FROM GENERATE SCRIPTS OPTION?
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-07-12 : 04:52:20
Please don't post in all caps, it's the online equivalent of shouting at us.

You can take a backup and restore it to a server that's never had that database on. There's absolutely not requirement for a database to already exist to restore from backup.

Databases -> Restore database (from object explorer)
In the database name drop down (assuming you're using management studio) type a new name.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-07-12 : 07:24:38
As yosiasz said: Right click database, Tasks : Generate scripts. Choose the options you want INCLUDING "Script data"
Go to Top of Page
   

- Advertisement -