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:\.

VB Code:
  1. CREATE DATABASE [Static] ON
  2. ( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Static.mdf' ),
  3. ( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Static_log.ldf' )
  4.  FOR ATTACH ;
  5. GO
Something like this would be perfect:
VB Code:
  1. CREATE DATABASE [Static] ON
  2. ( FILENAME = N %PROGRAMFILES% + '\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Static.mdf' ),
  3. ( FILENAME = N %PROGRAMFILES% + '\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Static_log.ldf' )
  4.  FOR ATTACH ;
  5. GO

Thanks guys,
Matt.