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 2000 Forums
 Transact-SQL (2000)
 FILENAME option in CREATE DATABASE statement

Author  Topic 

CiccioPasticcio
Starting Member

1 Post

Posted - 2004-11-09 : 06:00:11
Hi,

I have a problem with CREATE DATABASE statement, since it needs to specify the absolut path for a file in the FILENAME= option. I would need instead a relative path, i.e. only the name of the file because the script that launch this SQL command is dependant on the installation path decided by the user, during the installation.
Is there a way to pass to the FILENAME only the name of the file?
Hope to have been clear :-)

Thanks in advance,
Ciccio

amachanic
SQL Server MVP

169 Posts

Posted - 2004-11-09 : 10:25:55
No, unfortunately that parameter requires full path and filename. You could pull the path from the registry using xp_regread and then dynamically build your CREATE statement... The path is stored in HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSSQLServer/Setup/SQLDataRoot ...

Go to Top of Page
   

- Advertisement -