开发者

How to get Database name of sqlserver [duplicate]

开发者 https://www.devze.com 2023-03-22 02:52 出处:网络
This question already has answers here: 开发者_开发技巧How to query the name of the current SQL Server database instance?
This question already has answers here: 开发者_开发技巧 How to query the name of the current SQL Server database instance? (8 answers) Closed 8 years ago.

How to get Database name of a specific Database in a stored procedure.


To get the current database name use select db_name().

DB_NAME(Transact-SQL)


or

select name from sys.sysdatabases 
where dbid=db_id()

or

select DB_NAME(db_id())
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号