Technical Article

Much better way to "Get name of current database"

,

Use SQL's own method to get the current DBName, no function needed.

select db_name()

or

declare @DBName varchar(40)
select @DBName = db_name()

select @DBName as [DBName]

Rate

1.75 (4)

You rated this post out of 5. Change rating

Share

Share

Rate

1.75 (4)

You rated this post out of 5. Change rating