Amazon RDS SQL Server:如何检测它是否是 RDS?

2021-10-27 00:00:00 sql-server amazon-rds

我正在尝试将我的数据库移植到 RDS.由于限制,需要做一些更改.

I am trying to port my database to RDS. Need to do some changes because of restrictions.

是否可以检测当前数据库在 RDS 中的内部脚本(存储过程等)?

Is it possible to detect inside script (stored procedure etc) that current database is in RDS?

更新.我在我的函数中使用这种方式进行测试:

Upd. I use for the testing this way in my function:

if CHARINDEX(N'EC2AMAZ',(cast(serverproperty('ServerName') as nvarchar(256))))>0 
   return 1 
else 
   return 0

推荐答案

我在我的函数中使用这种方式:

I use this way in my function:

if CHARINDEX(N'EC2AMAZ',(cast(serverproperty('ServerName') as nvarchar(256))))>0 
   return 1 
else 
   return 0

现在可以了.

相关文章