Sinh Dinh
Right there with Babe
Points: 729
More actions
December 31, 2007 at 9:12 am
#201970
How do I find out what database I am connected to?
Example:
USE DB1
SET DB_Name = (?)
PRINT 'You are currently using ' + DB_Name
Results is:
You are currently using DB1
Strommy
SSCrazy
Points: 2386
December 31, 2007 at 9:21 am
#763717
You are very close.
[font="System"]declare @current_db sysname;
set @current_db = db_name();
select 'The current DB is ' + @current_db;[/font]
Thanks,
Eric
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply