Can't find error on a bulk insert of a CSV file to SQL Server Management Studio Express (2005)

I am trying to do a BULK INSERT of a .csv file in to SQL Server 2005, but I am getting two errors that I can't seem to fix.  I am using the free version of SQL Server Management Studio.  

Here is my insert statement:

BULK INSERT Temp.dbo.TO_Product
FROM 'C:\Temp\dowto_db_temp.csv'
WITH
      (FIELDTERMINATOR = ',',
       ROWTERMINATOR = '\n')

Here are the two errors I am getting:

Msg 4864, Level 16, State 1, Line 1
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 1 (nID).
Msg 4864, Level 16, State 1, Line 1
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 124, column 156 (Pertains_to_Dimension).

I have attached my .csv file in the form of .xls (.csv not allowed).  And i added the snippet of my table schema.  After saving it as .xls, I tried to bulk insert that, and received these errors:

Msg 4864, Level 16, State 1, Line 1
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 1 (nID).
Msg 4866, Level 16, State 8, Line 1
The bulk load failed. The column is too long in the data file for row 1, column 174. Verify that the field terminator and row terminator are specified correctly.
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".

If anyone has any thoughts, i would GREATLY appreciate it, it's driving me batty!
CREATE TABLE [dbo].[TO_Product](
	[nID] [int] IDENTITY(1,1) NOT NULL,
	[Title] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Display_Title] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Photo_File_Name] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Headline_1] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Headline_2] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Headline_3] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Headline_4] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_1] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_2] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_3] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_4] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_5] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_6] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_7] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_8] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_9] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_10] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_11] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_12] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_13] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_14] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_15] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_16] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_17] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_18] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_19] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_20] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_21] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_22] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Subhead_23] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_1] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_2] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_3] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_4] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_5] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_6] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_7] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_8] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_9] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_10] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_11] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_12] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_13] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_14] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_15] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_16] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_17] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_18] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_19] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_20] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_21] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_22] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_23] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_24] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_25] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_26] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_27] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_28] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_29] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_30] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_31] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_32] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_33] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_34] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_35] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_36] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_37] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_38] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_39] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_40] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_41] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_42] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_43] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_44] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_45] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_46] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_47] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_48] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_49] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_50] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_51] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_52] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_53] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_54] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_55] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_56] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_57] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_58] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_59] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_60] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_61] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_62] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_63] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_64] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_65] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_66] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_67] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_68] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_69] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_70] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_71] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_72] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_73] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_74] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_75] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_76] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_77] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_78] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_79] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_80] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_81] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_82] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_83] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_84] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_85] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_86] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_87] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_88] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_89] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_90] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_91] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_92] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_93] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_94] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_95] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_96] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_97] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_98] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_99] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_100] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_101] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_102] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_103] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_104] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_105] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_106] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_107] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_108] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_109] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_110] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_111] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_112] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_113] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_114] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_115] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_116] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_117] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_118] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_119] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_120] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_121] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_122] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Copyblock_123] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Confront] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Dimension] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Gallery] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Goal] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Kerb] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Lockup] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Lontrel] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Sapphire] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Scythe] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Showcase] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Snapshot] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Teampro] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Turflonester] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Dithane] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Eagle] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Fore] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Conserve] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Dursban] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Mach2] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Pertains_to_Curfew] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL CONSTRAINT [DF__TO_Product__0FA2421A]  DEFAULT ((0)),
 CONSTRAINT [TO_Product$PrimaryKey] PRIMARY KEY CLUSTERED 
(
	[nID] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

Open in new window

dowto-db-temp.xls
tarasheaAsked:
Who is Participating?
 
ZberteocConnect With a Mentor Commented:
Try by creating a linokles server to excel specifying the path ahd file name to the excel file. If the serever is local use a local path(folder) if the server is remote use a network path.

I tested it and I could select the data from the file. If the data is what you expected you can just insert it to a temp table or directly to your destination table.
EXEC sp_addlinkedserver ExcelFile,
     'Jet 4.0',
     'Microsoft.Jet.OLEDB.4.0',
     'file_path_here\dowto-db-temp.xls', 
      NULL,
     'Excel 5.0;'
GO
 
--Set up login mappings (just ADMIN - jet wants something).
EXEC sp_addlinkedsrvlogin ExcelFile, FALSE, NULL, Admin, NULL
GO
 
--List the tables in the linked server (these are the worksheet names).
EXEC sp_tables_ex ExcelFile
GO
 
 
select * 
--into #tbl				-- to create a temp table on the fly on the server
from ExcelFile...dowto_db_temp$
 
-- select * from #tbl	-- if the #tbl temp table was created
 
GO
-- remove linked server
sp_dropserver 'ExcelFile', 'droplogins'
GO

Open in new window

0
 
ZberteocCommented:
Bad misstype, i meant: "Try by creating a linked server..."
0
 
tarasheaAuthor Commented:
so everywhere you listed "ExcelFile" i need to replace that with my file name???
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
tarasheaAuthor Commented:
Zberteoc - I removed the one row that was giving me problems above, and the error no longer comes up, maybe just some quirky formatting in my csv file???  not sure.  But I still get the nID primary key error:

Msg 4864, Level 16, State 1, Line 1
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 1 (nID).

Is there some logic around inserting primary key fields???  

this was the column: [nID] [int] IDENTITY(1,1) NOT NULL,
0
 
ZberteocCommented:
You cannot insert values to an IDENTITY column unless you specify

SET INSERT_IDENTITY ON

run the import  and then

SET INSERT_IDENTITY OFF

However if that column is populated from the excel file and will have duplicates values then you could get in primary key violation error.
0
 
tarasheaAuthor Commented:
would the INSERT_IDENTITY method be with removing the nID column from my csv file before insert?  

with your method, do i replace all the "ExcelFile" entries with my file name?  

Just trying to find one method that works for me!  with your method, i received this error:

OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "ExcelFile" returned message "Could not find installable ISAM.".
Msg 7303, Level 16, State 1, Procedure sp_tables_ex, Line 41
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "ExcelFile".
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "ExcelFile" returned message "Could not find installable ISAM.".
Msg 7303, Level 16, State 1, Line 3
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "ExcelFile".

With the INSERT_IDENTITY method, i received this error:

Msg 195, Level 15, State 5, Line 1
'INSERT_IDENTITY' is not a recognized SET option.
Msg 195, Level 15, State 5, Line 9
'INSERT_IDENTITY' is not a recognized SET option.

I'm a total newbie, so I'm obviously doing plenty wrong....
0
 
tarasheaAuthor Commented:
oh, i see it's IDENTITY_INSERT....trying it now.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.