I have a TSQL code where some parts are not applicable to Managed Instance. Is there a way to determine in TSQL code is the code executed on Managed Instance and run the code only in that case?
Asked
Active
Viewed 49 times
1 Answers
0
SERVERPROPERTY('EngineEdition') is 8 only on Managed Instance so you can use this as a condition:
if SERVERPROPERTY('EngineEdition') = 8
begin
end
else
begin
end
See https://learn.microsoft.com/en-us/azure/sql-database/sql-database-managed-instance#how-to-programmatically-identify-a-managed-instance for more details.

Jovan MSFT
- 13,232
- 4
- 40
- 55