bcp AdventureWorks2008.HumanResources.Employee out C:\Data\EmployeeData.dat -T -c -U<login_id> -P<password> -S<server_name\instance_name>
Where we are giving password by using BCP command?
-
27-06-2022 - |
Pergunta
I am pretty much new to bcp but I researched quite a bit and can not find any resource that says where we are actually sending the user name and password to the database with this command. So everyone can access the database?
bcp AdventureWorks2008.HumanResources.Employee out C:\Data\EmployeeData.dat -T
Solução
Outras dicas
You aren't sending the username and password with the -T argument. In fact, it won't send any specified username and password to SQL Server if -T is present in the command line.
-T tells BCP to use Windows Authentication to connect to SQL Server. It will operate as the user who's running the command.
[-U login_id] [-P password]
Source: http://technet.microsoft.com/en-us/library/aa174646(v=sql.80).aspx
sample query with db credentials
bcp "SELECT * from yourtable" queryout c:\StockItemTransactionID_c.txt -c -Uusername -Pdbpassword -Sinstance -dYourDBName
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow