Hi Guys,
Is there any way using T-SQL to get the 'Program Files' path? E.g Can I get it to resolve something like %PROGRAMFILES% or %WINDIR%?
I ask cause I want to change the statement below so that its not hard coded to c:\.
Something like this would be perfect:VB Code:
CREATE DATABASE [Static] ON ( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Static.mdf' ), ( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Static_log.ldf' ) FOR ATTACH ; GO
VB Code:
CREATE DATABASE [Static] ON ( FILENAME = N %PROGRAMFILES% + '\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Static.mdf' ), ( FILENAME = N %PROGRAMFILES% + '\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Static_log.ldf' ) FOR ATTACH ; GO
Thanks guys,
Matt.
