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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Bulk Copy Error - Please help
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Niki
Yak Posting Veteran

51 Posts

Posted - 01/09/2013 :  12:45:07  Show Profile  Reply with Quote
IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'TblTempCPA')
DROP TABLE TblTempCPA
GO

CREATE TABLE TblTempCPA
(

StudentNo Varchar(10) NOT NULL,
StudentName Varchar(100),
ExitReason Varchar(10),
CompletionSts Varchar(10),
CONSTRAINT pk_TblTempCPA PRIMARY KEY (StudentNo)
);

GO

bcp dbo.TblTempCPA in 'C:\Current_CPA_CTE.xlsx' -T

The error I am getting is -
Msg 102, Level 15, State 1, Line 4
Incorrect syntax near '.'.


My excel sheet may have duplicate Studentno though. Is that the problem or BCP syntax?

Niki

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 01/09/2013 :  12:57:43  Show Profile  Reply with Quote
BCP is a command line utility. You need to run it from a command window. If you want to run it from a query window in SSMS, you should use xp_cmdshell.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 01/09/2013 :  22:43:01  Show Profile  Reply with Quote
see

http://www.sqlteam.com/article/exporting-data-programatically-with-bcp-and-xp_cmdshell

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

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.07 seconds. Powered By: Snitz Forums 2000