我试图确定我已经安装的sql server/sql express的实例(手动或编程),但所有的例子都告诉我运行一个sql查询来确定这假设我已经连接到一个特定的实例。
当前回答
另一个选择是运行SQLSERVER发现报告,进入SQLSERVER安装介质,双击setup.exe
在下一个屏幕中,转到工具并单击如下所示的发现报告
这将向你展示所有的实例以及整个功能..下面是我电脑上的快照
其他回答
我知道这个帖子有点老了,但在我找到我正在寻找的答案之前,我就看到了这个帖子,我想分享一下。如果您正在使用SQLExpress(或localdb),有一种更简单的方法来查找实例名。 在命令行类型中:
> sqllocaldb i
这将列出您在本地安装的实例名。因此,您的完整服务器名称应该在要连接的实例名称前面包含(localdb)\。此外,sqllocaldb允许您创建或删除实例以及配置它们。参见:SqlLocalDB Utility。
我知道这是一个老帖子,但我发现了一个很好的解决方案与PoweShell,你可以找到SQL实例安装在本地或远程机器上,包括版本,也可以扩展获得其他属性。
$MachineName = ‘.’ # Default local computer Replace . with server name for a remote computer
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey(‘LocalMachine’, $MachineName)
$regKey= $reg.OpenSubKey("SOFTWARE\\Microsoft\\Microsoft SQL Server\\Instance Names\\SQL" )
$values = $regkey.GetValueNames()
$values | ForEach-Object {$value = $_ ; $inst = $regKey.GetValue($value);
$path = "SOFTWARE\\Microsoft\\Microsoft SQL Server\\"+$inst+"\\MSSQLServer\\"+"CurrentVersion";
#write-host $path;
$version = $reg.OpenSubKey($path).GetValue("CurrentVersion");
write-host "Instance" $value;
write-host "Version" $version}
安装的所有实例都应该显示在Microsoft管理控制台的服务管理单元中。如果需要获取实例名,请执行“开始|运行|类型的服务”。查找所有带有“Sql Server(实例名)”的条目。
If you just want to see what's installed on the machine you're currently logged in to, I think the most straightforward manual process is to just open the SQL Server Configuration Manager (from the Start menu), which displays all the SQL Services (and only SQL services) on that hardware (running or not). This assumes SQL Server 2005, or greater; dotnetengineer's recommendation to use the Services Management Console will show you all services, and should always be available (if you're running earlier versions of SQL Server, for example).
If you're looking for a broader discovery process, however, you might consider third party tools such as SQLRecon and SQLPing, which will scan your network and build a report of all SQL Service instances found on any server to which they have access. It's been a while since I've used tools like this, but I was surprised at what they found (namely, a handful of instances that I didn't know existed). YMMV. You might Google for details, but I believe this page has the relevant downloads: http://www.sqlsecurity.com/Tools/FreeTools/tabid/65/Default.aspx
另一个选择是运行SQLSERVER发现报告,进入SQLSERVER安装介质,双击setup.exe
在下一个屏幕中,转到工具并单击如下所示的发现报告
这将向你展示所有的实例以及整个功能..下面是我电脑上的快照
推荐文章
- 等价的限制和偏移SQL Server?
- 如何从SQL Server中的字符串中剥离所有非字母字符?
- 为什么我不能在DELETE语句中使用别名?
- 多语句表值函数vs内联表值函数
- NOLOCK提示在SELECT语句中的作用
- SQL OVER()子句-它什么时候有用,为什么有用?
- 检查SQL Server登录是否已经存在
- 我如何使用ROW_NUMBER()?
- 如何检查表上持有哪些锁
- SQL Server数据库备份恢复到低版本
- SQL Server:过滤sp_who2的输出
- 在SQL Server上使用varchar(MAX) vs TEXT
- Visual Studio: ContextSwitchDeadlock
- Sql Server字符串到日期的转换
- 如何将SQL Azure数据库复制到本地开发服务器?