DB get Current DB Name

眉间皱痕 提交于 2021-01-28 00:40:00

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!