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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 bulk insert problem, int not recognized
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dainova
Starting Member

31 Posts

Posted - 11/15/2012 :  01:32:33  Show Profile  Reply with Quote
Hi, I'm running simple bulk insert and having this problem with setup like below


SET ANSI_NULLS ON 
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Tmsg] ( --ESEventlogMain1](
	[msgnumber] [int] NULL,
	[msgttype] [int] NULL,
	[mmsg] [varchar] (20) NULL
	) ON [PRIMARY]


---------------------------testx.txt
11111;2;The status for service
22222;2;Host ADM104 (ADM Group)
33333;2;The status for service
---------------------------
BULK INSERT Tmsg FROM 'C:\Users\memb1\testx.txt'
WITH (FIELDTERMINATOR = ';', rowterminator = '\n')

--------------------------
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 (msgnumber).
---------------------------
select * from tmsg
msgnumber msgttype mmsg
----------- ----------- ----------------------------------------
22222 2 Host ADM104 (ADM Group)
33333 2 The status for service

Edited by - dainova on 11/15/2012 01:33:44

Lumbago
Norsk Yak Master

Norway
3271 Posts

Posted - 11/15/2012 :  03:23:02  Show Profile  Reply with Quote
Try with [mmsg] [varchar] (200) NULL instead

- Lumbago
My blog-> http://thefirstsql.com
Go to Top of Page

dainova
Starting Member

31 Posts

Posted - 11/15/2012 :  09:22:03  Show Profile  Reply with Quote
Tx, Lumbago. I tried this, same result
Go to Top of Page

Lumbago
Norsk Yak Master

Norway
3271 Posts

Posted - 11/15/2012 :  09:42:11  Show Profile  Reply with Quote
What is the code page of the file you are importing? If you don't know you can open it in NotePad++ (a free tool EVERYBODY should use) and it will say the code page in the bottom right corner.

- Lumbago
My blog-> http://thefirstsql.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.04 seconds. Powered By: Snitz Forums 2000