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.
| Author |
Topic |
|
ujjaval
Posting Yak Master
108 Posts |
Posted - 2006-09-18 : 22:13:15
|
| I have a web application which runs with SQL Server 7.0 database. Now, I am trying to create a deployment package or something where the entire application can be deployed to new servers. Now, I am having at the moment a batch file which runs DDL generated by SQL Server 7.0 to create a new database at another server. Now, I need some of the tables in database to have some data already in it at the time of deployment. I am just wondering what is the best way to have those data available in those table upon creation of that database on new server?Thanks,Ujjaval |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2006-09-18 : 23:08:05
|
| Why don't you create a baselined database, detach it, then re-attach it using the system stored procs?Much easier than faffing about with DDL scripts etc. Otherwise, you can create one or more scripts to do the data inserting. Or you can have all your data as flat files and BCP/bulk insert them into your database. |
 |
|
|
ujjaval
Posting Yak Master
108 Posts |
Posted - 2006-09-19 : 20:12:38
|
| Hi Timmy,Thanks for that. I could do bulk insert. But just wondering, could you tell me more about basedline database. Haven't heard that before? How do you do that?Thanks,Ujjaval |
 |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2006-09-19 : 20:35:17
|
| You create a database containing all your structures and reference data. You then detach it using sp_detach_db. This will leave you with an MDF and LDf file. You can ditch the LDF because it's only the log and you won't need it for your purpose.Then during your install routine, connect to the database (using SQLDMO libraries or isql) and issue the sp_attach_db command to attach the database to the destination server. Check out the syntax of sp_attach_db in BOL because you will need to tell SQL Server to re-create the LDF from scratch.Then all you should need to do is create the logins required (as these are not done at DB level). HTH,Tim |
 |
|
|
|
|
|
|
|