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.

MAhmadi
  • 11
  • 4
  • 2
    Login as `mydomain\myuser` and run `sqlcmd -S myserver\myinstance -E` or invoke sqlcmd with [`RUNAS`](https://en.wikipedia.org/wiki/Runas) to specify alternate credentials. – Dan Guzman Nov 01 '20 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 Nov 01 '20 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 Nov 01 '20 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 Nov 01 '20 at 11:50

1 Answers1

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.

MAhmadi
  • 11
  • 4