Skip to content

Instantly share code, notes, and snippets.

@pawelel
Created December 20, 2021 20:54
Show Gist options
  • Save pawelel/3a45fdf6ccab7d444d8636324990662f to your computer and use it in GitHub Desktop.
Save pawelel/3a45fdf6ccab7d444d8636324990662f to your computer and use it in GitHub Desktop.
Connection String from SSMS
select
'data source=' + @@servername +
';initial catalog=' + db_name() +
case type_desc
when 'WINDOWS_LOGIN'
then ';trusted_connection=true'
else
';user id=' + suser_name()
end
from sys.server_principals
where name = suser_name()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment