Today I have tried BCP command to import data from text file. It gives me a error when I used trusted connection like -T as parameter. Then I used Server name, User name and Password then its working fine. Following are the steps for Import.
Now you have done.
Suggestions are always welcome.
Thanks.
- Create a text file into your working directory like C:\neeraj\contact.txt
- Create a table into your working database
CREATE TABLE [dbo].[Contact](
[Email] [varchar](100) NULL,
[FirstName] [varchar](50) NULL,
[LastName] [varchar](50) NULL
) ON [PRIMARY]
GO
- Put some data into text file as per table column with comma separated.
- Open command prompt.
- Go to the text file directory.
- Write BCP command here.
C:\Neeraj>BCP database.dbo.contact IN contact.txt -c -t, -S servername -U sa -P *** -r\n
Starting copy...
3 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total : 16 Average : (187.50 rows per sec.)
C:\Neeraj>
Now you have done.
Suggestions are always welcome.
Thanks.

