开发者

How to get Database name of sqlserver [duplicate]

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜