问题
I need to write a SQL Script in DB2 and I have to make a constraint in order for this SQL to run only on some specific DBs.
I looked online for solutions but I did not find any.
Does anybody know a way to get the name of the current connected DB?
回答1:
Try this:
Select CURRENT_SERVER from sysibm.sysdummy1
The database name can be retrieved via the special register CURRENT_SERVER
.
来源:https://stackoverflow.com/questions/41676027/db-get-current-db-name