如何确定SQL Server 2008或更高版本
我需要以编程方式确定数据库是否支持地理数据类型和空间索引。这些功能是在 2008 年引入的。我还需要确定是否启用了 CLR,因为这些功能依赖于它。最可靠的方法是什么?
I need to determine programmatically if the database supports the Geography data type and Spatial indexes. These features were introduced in 2008. I also need to determine if CLR is enabled as these features rely on it. What is the most reliable way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
SQL Server 2008 是 10.x
您可以在 SQL 和查询中使用 SERVERPROPERTY sys.configurations
编辑:添加了CAST
SQL Server 2008 is 10.x
You can use SERVERPROPERTY in SQL and query sys.configurations
Edit: added CAST
解析以下内容:
如:
输出:
parse the following:
like:
output:
您可以使用 SELECT @@VERSION 来返回相当详细的字符串。
更简单的方法是使用 This 返回一个数字来查看数据库兼容性级别
。常见的值如下:
这样做的另一个好处是检查服务器上的数据库是否处于所需的级别,而不仅仅是检查服务器本身是否运行特定的系统版本。
You can use
SELECT @@VERSION
which returns a fairly verbose string.Easier is to look at the DB compatibility level using
This returns a numeric. Frequent values are such as:
This has the added benefit of checking that the database on the server is at the required level, not just that the server itself it running a particular system version.
使用下面提到的查询
来查找下面提到的版本。
Use the below mentioned query
For the bellow mentioned Versions to find out.