Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 BCP in

Author  Topic 

mayaaa
Starting Member

15 Posts

Posted - 2012-08-09 : 20:54:33
Hi,

I'm trying to load a small txt file into a SQL table.. would really appreciate it if someone could help me.
I'm using the BCP in command in cmd but I get this error message:

C:\>bcp Resolvit.Simple_EH_Forecast in C:\bb\test.txt -c -S test
-PC\SQLEXPRESS -T -F 2 -e
SQLState = S0002, NativeError = 208
Error = [Microsoft][SQL Server Native Client 10.0][SQL Server]Invalid object nam
e tapuz.test'.


Thank you!!

xhostx
Constraint Violating Yak Guru

277 Posts

Posted - 2012-08-10 : 09:10:34
try this, but keep in mind that all data will be copied into one column. if you need to copy into a table that is composed of many columns use bulk insert instead.

eg:
bcp DBname..TableName in c:\folder1\folder2\test.txt /c /U /P /r\n


make sure that you have the right credentials (U is the user eg: /Usa) and (P is the password eg: /Ppass).

You may want to look at the your role account under security to make sure your have all privileges to bcp.

--------------------------
Joins are what RDBMS's do for a living
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-10 : 09:59:08
also the paths specified are server paths so if your file is in remote path make sure you specify it in UNC format

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

mayaaa
Starting Member

15 Posts

Posted - 2012-08-10 : 11:46:30
Thank you!
I've used BULK INSERT and it worked :)
Go to Top of Page
   

- Advertisement -