![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi! I want to import a tab separated textfile to a SQL 2000 table. The row terminator in the textfile is newline. Funlayer.txt: Value1 003 Value2 4,7625 value3 7,0000 ************************************* Commandline: bcp TEST..FunLayer in FunLayer.txt -Slocalhost -T -r\n - fbcp.fmt *********************************** bcp.fmt file: 8.0 3 1 SQLINT 0 0 "" 1 ID "" 2 SQLCHAR 0 50 "\t" 2 MNummer Finnish_Swedish_CI_AS 3 SQLCHAR 0 50 "\t" 3 InnerDiam Finnish_Swedish_CI_AS ********************************************** --Db table if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FunLayer]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[FunLayer] GO CREATE TABLE [dbo].[FunLayer] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [MNummer] [varchar] (50) COLLATE Finnish_Swedish_CI_AS NULL , [InnerDiam] [decimal](18, 3) NULL ) ON [PRIMARY] GO **************************************** Errormessage: Starting copy... SQLState = 22005, NativeError = 0 Error = [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification SQLState = 22005, NativeError = 0 Error = [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification SQLState = S1000, NativeError = 0 Error = [Microsoft][ODBC SQL Server Driver]Unexpected EOF encountered in BCP data-file 1 rows copied. Network packet size (bytes): 4096 Clock Time (ms.): total 10 **************************** How can I make it work...? Thanks! |
#3
| |||
| |||
|
|
Hi! I want to import a tab separated textfile to a SQL 2000 table. The row terminator in the textfile is newline. Funlayer.txt: Value1 003 Value2 4,7625 value3 7,0000 ************************************* Commandline: bcp TEST..FunLayer in FunLayer.txt -Slocalhost -T -r\n - fbcp.fmt *********************************** bcp.fmt file: 8.0 3 1 SQLINT 0 0 "" 1 ID "" 2 SQLCHAR 0 50 "\t" 2 MNummer Finnish_Swedish_CI_AS 3 SQLCHAR 0 50 "\t" 3 InnerDiam Finnish_Swedish_CI_AS ********************************************** --Db table if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FunLayer]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[FunLayer] GO CREATE TABLE [dbo].[FunLayer] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [MNummer] [varchar] (50) COLLATE Finnish_Swedish_CI_AS NULL , [InnerDiam] [decimal](18, 3) NULL ) ON [PRIMARY] GO **************************************** Errormessage: Starting copy... SQLState = 22005, NativeError = 0 Error = [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification SQLState = 22005, NativeError = 0 Error = [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification SQLState = S1000, NativeError = 0 Error = [Microsoft][ODBC SQL Server Driver]Unexpected EOF encountered in BCP data-file 1 rows copied. Network packet size (bytes): 4096 Clock Time (ms.): total 10 **************************** How can I make it work...? Thanks! |
#4
| |||
| |||
|
|
-----Original Message----- you don't need the format file since its default tab and line feed and file type is plain text bcp test..funlayer in funlayer.txt -T -Slocalhost -c "Rulle" <anonymous (AT) discussions (DOT) microsoft.com> wrote in message news:0bb301c3a479$66822870$a601280a (AT) phx (DOT) gbl... Hi! I want to import a tab separated textfile to a SQL 2000 table. The row terminator in the textfile is newline. Funlayer.txt: Value1 003 Value2 4,7625 value3 7,0000 ************************************* Commandline: bcp TEST..FunLayer in FunLayer.txt -Slocalhost -T -r\n - fbcp.fmt *********************************** bcp.fmt file: 8.0 3 1 SQLINT 0 0 "" 1 ID "" 2 SQLCHAR 0 50 "\t" 2 MNummer Finnish_Swedish_CI_AS 3 SQLCHAR 0 50 "\t" 3 InnerDiam Finnish_Swedish_CI_AS ********************************************** --Db table if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FunLayer]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[FunLayer] GO CREATE TABLE [dbo].[FunLayer] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [MNummer] [varchar] (50) COLLATE Finnish_Swedish_CI_AS NULL , [InnerDiam] [decimal](18, 3) NULL ) ON [PRIMARY] GO **************************************** Errormessage: Starting copy... SQLState = 22005, NativeError = 0 Error = [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification SQLState = 22005, NativeError = 0 Error = [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification SQLState = S1000, NativeError = 0 Error = [Microsoft][ODBC SQL Server Driver]Unexpected EOF encountered in BCP data-file 1 rows copied. Network packet size (bytes): 4096 Clock Time (ms.): total 10 **************************** How can I make it work...? Thanks! . |
#5
| |||
| |||
|
|
-----Original Message----- I've tried the your suggested command. It seems that it can not interpret the newline character correctly. Any ideas? bcp TEST..FunLayer in FunLayer.txt -Slocalhost -T -c Starting copy... SQLState = 22005, NativeError = 0 Error = [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification SQLState = 22005, NativeError = 0 Error = [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification 1 rows copied. Network packet size (bytes): 4096 Clock Time (ms.): total 1 /Rulle -----Original Message----- you don't need the format file since its default tab and line feed and file type is plain text bcp test..funlayer in funlayer.txt -T -Slocalhost -c "Rulle" <anonymous (AT) discussions (DOT) microsoft.com> wrote in message news:0bb301c3a479$66822870$a601280a (AT) phx (DOT) gbl... Hi! I want to import a tab separated textfile to a SQL 2000 table. The row terminator in the textfile is newline. Funlayer.txt: Value1 003 Value2 4,7625 value3 7,0000 ************************************* Commandline: bcp TEST..FunLayer in FunLayer.txt -Slocalhost -T - r\n - fbcp.fmt *********************************** bcp.fmt file: 8.0 3 1 SQLINT 0 0 "" 1 ID "" 2 SQLCHAR 0 50 "\t" 2 MNummer Finnish_Swedish_CI_AS 3 SQLCHAR 0 50 "\t" 3 InnerDiam Finnish_Swedish_CI_AS ********************************************** --Db table if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FunLayer]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[FunLayer] GO CREATE TABLE [dbo].[FunLayer] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [MNummer] [varchar] (50) COLLATE Finnish_Swedish_CI_AS NULL , [InnerDiam] [decimal](18, 3) NULL ) ON [PRIMARY] GO **************************************** Errormessage: Starting copy... SQLState = 22005, NativeError = 0 Error = [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification SQLState = 22005, NativeError = 0 Error = [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification SQLState = S1000, NativeError = 0 Error = [Microsoft][ODBC SQL Server Driver]Unexpected EOF encountered in BCP data-file 1 rows copied. Network packet size (bytes): 4096 Clock Time (ms.): total 10 **************************** How can I make it work...? Thanks! . . |
![]() |
| Thread Tools | |
| Display Modes | |
| |