How to test if database is hosted on SQL Azure?(如何测试数据库是否托管在 SQL Azure 上?)
问题描述
是否可以测试数据库是否托管在 SQL Azure 上?我正在查看 EF6 的 SqlAzureExecutionStrategy 并且只想在数据库实际上是 SQL Azure 数据库时应用.
Is it possible to test whether a database is hosted on SQL Azure? I am looking at SqlAzureExecutionStrategy for EF6 and only want to apply if the database is actually SQL Azure database.
目前我正在测试应用程序是否在 Azure 中运行.但是,我们正在考虑允许客户端自己托管 DB,因此希望通过某种方式来确定 DB 是 SQL Server 还是 Azure SQL.
Currently I am testing if App is running within Azure. However we are looking at allowing clients to host DB themselves so would like some way to identify if DB is a SQL Server or Azure SQL.
假设 EF 不知道,因为它隐藏了实现细节.
Assume EF won't know as it is hiding the implementation details.
我猜可能只是一个配置设置.只是想知道这在技术上是否可行.
Could just have a config setting I guess. Just wondered if it was technically possible.
推荐答案
于 2021 年 8 月更新以与更新的文档保持一致
SELECT CASE ServerProperty('EngineEdition')
WHEN 1 THEN 'Personal'
WHEN 2 THEN 'Standard'
WHEN 3 THEN 'Enterprise'
WHEN 4 THEN 'Express'
WHEN 5 THEN 'SQL Database'
WHEN 6 THEN 'Azure Synapse Analytics'
WHEN 8 THEN 'Azure SQL Managed Instance'
WHEN 9 THEN 'Azure SQL Edge'
WHEN 11 THEN 'Azure Synapse serverless SQL pool'
ELSE 'Unknown'
END
http://technet.microsoft.com/en-us/library/ms174396.aspx
这篇关于如何测试数据库是否托管在 SQL Azure 上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何测试数据库是否托管在 SQL Azure 上?


基础教程推荐
- 从字符串 TSQL 中获取数字 2021-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- 带更新的 sqlite CTE 2022-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01