Saturday, December 18, 2010

COPYING TABLE ROWS INTO A DATA FILE

COPYING TABLE ROWS INTO A DATA FILE (WITH MIXED-MODE AUTHENTICATION)

if we using mixed-mode authentication, wemust use the -U switch to specify your login ID. Also, unless you are connecting to the default instance of SQL Server on the local computer, use the -S switch to specify the system name and, optionally, an instance name.

Syntax:

  bcp AdventureWorks.Sales.Currency out Currency.dat -c -U login_id server_name\instance_name

example

bcp AdventureWorks.Sales.Currency out Currency.dat -c -U sa -P nagercoil -S localhost\sqlexpress


sa-->loginid

nagercoil---> password

localhost ---->server_name

sqlexpress---->instance_name




the below figure shows copies data between an instance of Microsoft SQL Server 2005 and a data file in a user-specified format(dat or txt or any other user defined format)


No comments:

Post a Comment