2
votes

i want use bcp but i cant remote to data base i use this command but i get error below:

bcp "Select personelid, '13'+date date, scheduleid, scheduleGroupName, DetailCollectionID, Name, TimesStructure, DayNO, Sequence, WPID, ToleranceTimes, DayState, StructureID, ID, STime, ETime from framework.att.PersonDateStructure" queryout "D:\test\pds.txt" -T -c -S 10.0.0.108 -U sa -P 0000

but i get this error:

SQLState = 28000, NativeError = 18456 Error = [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'KASRA\mnaghsh

1
Error seems pretty clear here, what about the error don't you understand so we can try to elaborate? - Larnu
my system is in the domain.@Larnu - Mohammad Naghsh
But clearly the login your using isnt a login on the server. The domain has nothing to do with that. Seems you don't understand the error. It's telling you that the windows login your using to connection to SQL Server (KASRA\mnaghsh) does not have a login on the server you are trying to connect to, the said login had been denied logon permissions, or it does not have a mapped user in the database you're providing in your connection string. - Larnu
i should build login with this name(KASRA\mnaghsh) in sql?@Larnu - Mohammad Naghsh
I don't understand your comment. I'm not sure what else I can explain here. The error is self explanatory, and I've expanded on it. If you don't understand any of that, the no suggest reading up on SQL Server and logins, as you're missing fundamental understanding about authentication. - Larnu

1 Answers

3
votes

You have specified the username&password (sa, 0000) using the -U -P flags but at the same time you have set the -T flag/argument which is for windows authentication, that is the reason you are getting the login failure message (apparently your domain account is not a valid sql server login), just remove the -T.