Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 TSQL 代码,其中某些部分不适用于托管实例。有没有办法在 TSQL 代码中确定代码是否在托管实例上执行并仅在这种情况下运行代码?
SERVERPROPERTY('EngineEdition') 仅在托管实例上为 8,因此您可以将其用作条件:
if SERVERPROPERTY('EngineEdition') = 8 begin end else begin end
有关更多详细信息,请参阅https://docs.microsoft.com/en-us/azure/sql-database/sql-database-managed-instance#how-to-programmatically-identify-a-managed-instance。