0

I need to Use Windows User for SQLCMD.

C:\Users\Administrator>sqlcmd -S myserver\myinstance -U mydomain\myuser -P ***

This Command Not Correct . How Can I figured This? Windows Authentication Is OK! Password is Correct! Windows User Added To SQL Login.

4
  • 2
    Login as mydomain\myuser and run sqlcmd -S myserver\myinstance -E or invoke sqlcmd with RUNAS to specify alternate credentials.
    – Dan Guzman
    Commented Nov 1, 2020 at 10:48
  • If you are specifying a username and password, then you are using SQL Authentication; a trusted connection uses the existing already authenticated account that is currently logged in.
    – Thom A
    Commented Nov 1, 2020 at 10:59
  • yes,thanks. i know this but i need to send windows user as sql user in some application that need connection. i want to know specific syntax for use windows user in that app. that app could not use [domain\user] for connect to db.
    – MAhmadi
    Commented Nov 1, 2020 at 11:09
  • If you need to connect as a different user from an application, you need to use impersonation; you cannot pass Windows Credentials like SQL Authentication credentials.
    – Thom A
    Commented Nov 1, 2020 at 11:50

1 Answer 1

1

If you need to connect as a different user from an application, you need to use impersonation; you cannot pass Windows Credentials like SQL Authentication credentials.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.