I am trying to BULK INSERT a csv file to my SQL Server.

Using code I found on this SO question, I ran:

BULK INSERT Temp 
FROM 'c:\csv\student.csv '  
WITH ( 
       FIELDTERMINATOR = ',', 
       ROWTERMINATOR   = '\n', 
       FIRSTROW        = 2 
     ) 

I got this error:

Msg 208 , Level 16 , state 82 , Line 1
Invalid object name 'Temp' .

What can I do?

closed as off-topic by Andriy M, mustaccio, RDFozz, LowlyDBA, Tom V Jul 20 at 9:09

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Too localized - this could be because your code has a typo, basic error, or is not relevant to most of our audience. Consider revising your question so that it appeals to a broader audience. As it stands, the question is unlikely to help other users (regarding typo questions, see this meta question for background)." – Andriy M, mustaccio, RDFozz, LowlyDBA, Tom V
If this question can be reworded to fit the rules in the help center, please edit the question.

Your error message means the object can't be found in the context of the session where you're executing your BULK INSERT. This could be because...

  1. The object does not exist and needs to be created. Try CREATE TABLE [Temp] ( ...
    • Also check for typos, did you mean to insert into Temp2 instead?
    • You may need to specify the schema name. Are you trying to insert into foo.Temp instead of dbo.Temp?
  2. You are connected to the wrong database OR server OR are using the wrong credentials.
    • Do you get the same error message when you run select top(1) * from [Temp]; In the same session where you got the error message the first time?

Other reading:

Not the answer you're looking for? Browse other questions tagged or ask your own question.