Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm connected to database. I use db by Management Studio 2012 Express. Can I check connection string by click something in Management Studio?

share|improve this question

migrated from stackoverflow.com Jul 8 '12 at 1:09

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 5 down vote accepted

Within SSMS, I'm not sure there's an easy way to do that. But a simple query will return you the information (without the password of a connection string, obviously):

    'data source=' + @@servername +
    ';initial catalog=' + db_name() +
    case type_desc
        when 'WINDOWS_LOGIN' 
            then ';trusted_connection=true'
            ';user id=' + suser_name()
from sys.server_principals
where name = suser_name()

Note, db_name() will return the current database name if there is no parameter specified, so that is dependent on your current scope.

share|improve this answer
This ws exactly what I needed. Thanks. –  user42318 Jul 7 '14 at 15:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.