方法1:
declare @path varchar(200)
exec master.dbo.xp_regread
'HKEY_LOCAL_MACHINE',
'SOFTWARE/Microsoft/MSSQLSERVER/setup',
'SQLPath',@path output
set @path = @path + '/data/'
print @path
方法2:
declare @path varchar(200)
select @path = filename from master.dbo.sysfiles
set @path = ltrim(REVERSE(@path))
set @path = REVERSE(substring(@path,CHARINDEX('/',@path),len(@path)))
print @path
如何得到SQL Server的安装路径
最新推荐文章于 2021-11-11 10:10:58 发布