[英]SQL Server Database Project: Get Visual Studio Assembly Version on Pre-Deploy Scripts
I want to know the current version of the visual studio project assembly version from VS settings before I deploy my database to the target. 在将数据库部署到目标之前,我想从VS设置中了解Visual Studio项目程序集版本的当前版本。 Is there any way to get the version in T-SQL SQL-CMD command to decide what action is needed to take? 有什么方法可以在T-SQL SQL-CMD命令中获取版本来决定需要采取什么措施?
I assume you're asking about the DB compatibility level, not the server version? 我假设您是在询问数据库兼容性级别,而不是服务器版本? You can query sys.databases for your DB name as follows. 您可以按以下方式查询sys.databases作为您的数据库名称。
select
name, compatibility_level , version_name =
CASE compatibility_level
WHEN 80 THEN 'SQL 2000'
WHEN 90 THEN 'SQL 2005'
WHEN 100 THEN 'SQL 2008'
WHEN 110 THEN 'SQL 2012'
WHEN 120 THEN 'SQL 2014'
END
from sys.databases
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.