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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-03-25 : 07:39:00
|
| Derek Noonan writes "We support both SQL Server 7 and 2000 with our applications. We create the database, tables and relationships during the install process using osql and bcp any necessary data into the tablesQuestion to you is, how can I use the same SQL script to support both versions as the default location for the files has changed between versions. (from C:\MSSQL7\data to C:\Program Files\Microsoft SQL Server\MSSQL\Data)SQL-DMO provides for the following:<VBSCRIPT>Set objSqlServer = New SQLDMO.SQLServer2With objSqlServer ' Other code here omitted for brevity strDataFilePath = .Databases("master", "sa").PrimaryFilePathEnd With</VBSCRIPT>The variable strDataFilePath now contains the location of the primary filesHowever, ideally I'd like not to use SQL-DMO as it doesn't just suit here. What I'd like to do is know if there's an intrinsic T-SQL fn. that can obtain the location of the logs and files so I can just write one T-SQL script to support the two versions Thanks in advance,Derek Noonan" |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2003-03-25 : 07:58:21
|
| In either version, you can put the data files and log files anywhere. Why not move all your databases to the same place? Then you don't need to do this song and dance.Otherwise, take a look at sysfiles, maybe.Jay White{0} |
 |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2003-03-25 : 08:32:53
|
| Have you looked at sp_HelpDB ?You may be able to use it directly, or see how it is built to create your own code.As Jay suggests though, I think you will find the answer (and the basis of sp_HelpDB) lies in sysfiles.Damian |
 |
|
|
|
|
|