Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where we are giving password by using BCP command?

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
like image 936
Bernard Avatar asked Sep 05 '13 17:09

Bernard


People also ask

What is BCP command?

The bulk copy program utility (bcp) bulk copies data between an instance of Microsoft SQL Server and a data file in a user-specified format. The bcp utility can be used to import large numbers of new rows into SQL Server tables or to export data out of tables into data files.

Does BCP lock table?

When you copy in to a table using bcp —particularly when you copy in to a table using parallel bcp —the copy process acquires the following locks: An exclusive intent lock on the table.

What driver does BCP use?

The bcp utility is available with the Microsoft ODBC Driver for SQL Server on Linux and macOS.


2 Answers

bcp AdventureWorks2008.HumanResources.Employee out C:\Data\EmployeeData.dat -T -c -U<login_id> -P<password> -S<server_name\instance_name>
like image 125
Sonam Avatar answered Oct 11 '22 14:10

Sonam


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.

like image 33
djdanlib Avatar answered Oct 11 '22 13:10

djdanlib