Showing posts with label load. Show all posts
Showing posts with label load. Show all posts

Friday, March 30, 2012

numeric overflow

Hi,
I'm trying to load a table from a dts job that selects all the records from
sybase table and imports it into an equivalent MS SQL 2000 table.
I have done this successfully for 16 tables.
However for one table I get the following error on insert:
Error at source for row number 38014.
Errors encountered for this task: 1
[DataDirect][ODBC Sybase Wire Protocol Driver]Numeric Overflow. Erro
r in
column 16.
[DataDirect][ODBC Sybase Wire Protocol Driver]Error in row.
I have checked the column definitions for the table and as far as I can
determine both the Sybase and MS table match. Column 16 is of money data
type. Any ideas causing the error?
Thanks!!gracie wrote:
> Hi,
> I'm trying to load a table from a dts job that selects all the
> records from sybase table and imports it into an equivalent MS SQL
> 2000 table.
> I have done this successfully for 16 tables.
> However for one table I get the following error on insert:
> Error at source for row number 38014.
> Errors encountered for this task: 1
> [DataDirect][ODBC Sybase Wire Protocol Driver]Numeric Overflow. Er
ror
> in column 16.
> [DataDirect][ODBC Sybase Wire Protocol Driver]Error in row.
> I have checked the column definitions for the table and as far as I
> can determine both the Sybase and MS table match. Column 16 is of
> money data type. Any ideas causing the error?
> Thanks!!
Have you looked at the data in row 38014 to see what is in the table?
David Gugick
Imceda Software
www.imceda.comsql

numeric overflow

Hi,
I'm trying to load a table from a dts job that selects all the records from
sybase table and imports it into an equivalent MS SQL 2000 table.
I have done this successfully for 16 tables.
However for one table I get the following error on insert:
Error at source for row number 38014.
Errors encountered for this task: 1
[DataDirect][ODBC Sybase Wire Protocol Driver]Numeric Overflow. Error in
column 16.
[DataDirect][ODBC Sybase Wire Protocol Driver]Error in row.
I have checked the column definitions for the table and as far as I can
determine both the Sybase and MS table match. Column 16 is of money data
type. Any ideas causing the error?
Thanks!!gracie wrote:
> Hi,
> I'm trying to load a table from a dts job that selects all the
> records from sybase table and imports it into an equivalent MS SQL
> 2000 table.
> I have done this successfully for 16 tables.
> However for one table I get the following error on insert:
> Error at source for row number 38014.
> Errors encountered for this task: 1
> [DataDirect][ODBC Sybase Wire Protocol Driver]Numeric Overflow. Error
> in column 16.
> [DataDirect][ODBC Sybase Wire Protocol Driver]Error in row.
> I have checked the column definitions for the table and as far as I
> can determine both the Sybase and MS table match. Column 16 is of
> money data type. Any ideas causing the error?
> Thanks!!
Have you looked at the data in row 38014 to see what is in the table?
--
David Gugick
Imceda Software
www.imceda.com

numeric overflow

Hi,
I'm trying to load a table from a dts job that selects all the records from
sybase table and imports it into an equivalent MS SQL 2000 table.
I have done this successfully for 16 tables.
However for one table I get the following error on insert:
Error at source for row number 38014.
Errors encountered for this task: 1
[DataDirect][ODBC Sybase Wire Protocol Driver]Numeric Overflow. Error in
column 16.
[DataDirect][ODBC Sybase Wire Protocol Driver]Error in row.
I have checked the column definitions for the table and as far as I can
determine both the Sybase and MS table match. Column 16 is of money data
type. Any ideas causing the error?
Thanks!!
gracie wrote:
> Hi,
> I'm trying to load a table from a dts job that selects all the
> records from sybase table and imports it into an equivalent MS SQL
> 2000 table.
> I have done this successfully for 16 tables.
> However for one table I get the following error on insert:
> Error at source for row number 38014.
> Errors encountered for this task: 1
> [DataDirect][ODBC Sybase Wire Protocol Driver]Numeric Overflow. Error
> in column 16.
> [DataDirect][ODBC Sybase Wire Protocol Driver]Error in row.
> I have checked the column definitions for the table and as far as I
> can determine both the Sybase and MS table match. Column 16 is of
> money data type. Any ideas causing the error?
> Thanks!!
Have you looked at the data in row 38014 to see what is in the table?
David Gugick
Imceda Software
www.imceda.com

Wednesday, March 7, 2012

NULL values in XML string

Can someone tell me how to format my XML string so when I load it into my
table the field actually has a NULL value and not an empty space?
My XML string is formated like this.
<reimbursement>
<tbl_Reimbursement>
<Type10Rec Provider_Type='INSTIT' Provider_SubType='11' ReimDesc=""
Status='PMA' CreateUsr='Test' LastModDate="" LastModUsr="" ApproveDate=""/>
</tbl_Reimbursement><
The problem is that I want the ones with nothing between the doublw quotes
to get entered into the table as NULL values not empty strings. I am having
difficulty doing this. Can someone help me? Thanks in advance.>> The problem is that I want the ones with nothing between the doublw
What is the datatype of the columns in the table? Do you have a default set
for these columns, if the values are missing?Why not post the DDLs here? Are
you using OPENXML to load the data or using some other 3rd party tools?
Anith|||CREATE TABLE [tbl_Reimbursement] (
[ReimID] [int] IDENTITY (1, 1) NOT NULL ,
[RecordType] [varchar] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
CONSTRAINT [DF_Reimbursement_RecordType] DEFAULT (10),
[ActionType] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
CONSTRAINT [DF_tbl_Reimbursement_ActionType] DEFAULT ('A'),
[Provider_Type] [varchar] (6) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Provider_SubType] [varchar] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[NetworkCode] [varchar] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
CONSTRAINT [DF_tbl_Reimbursement_NetworkCode] DEFAULT (' '),
[EffectiveDate] [datetime] NOT NULL CONSTRAINT
[DF_tbl_Reimbursement_EffectiveDate] DEFAULT ('6/1/2004'),
[ExpirationDate] [datetime] NOT NULL CONSTRAINT
[DF_tbl_Reimbursement_ExpirationDate] DEFAULT ('12/31/2099'),
[ReimDesc] [varchar] (70) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Status] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[SubmitDate] [datetime] NULL ,
[SubmitUsr] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ExportID] [int] NULL ,
[ExportDate] [datetime] NULL ,
[ApproveDate] [datetime] NULL ,
[ApproveUsr] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[CreateDate] [datetime] NULL CONSTRAINT [DF_tbl_Reimbursement_CreateDate]
DEFAULT (getdate()),
[CreateUsr] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ExportSeq] [int] NULL CONSTRAINT [DF_tbl_Reimbursement_ExportSeq] DEFAULT
(1),
[LastModDate] [datetime] NULL ,
[LastModUsr] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ReimLocked] [bit] NULL ,
[ReimLockedBy] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
CONSTRAINT [PK_Reimbursement] PRIMARY KEY CLUSTERED
(
[ReimID]
) WITH FILLFACTOR = 90 ON [PRIMARY] ,
) ON [PRIMARY]
GO
insert into tbl_Reimbursement (Provider_Type, Provider_SubType, ReimDesc,
Status, CreateUsr, LastModDate, LastModUsr, ApproveDate, ApproveUsr)
select * from OPENXML (@.idoc,'/reimbursement/tbl_Reimbursement/Type10Rec',1)
with (Provider_Type varchar(6),
Provider_SubType varchar(2),
ReimDesc varchar(70),
Status varchar(10),
CreateUsr varchar(50),
LastModDate datetime,
LastModUsr varchar(50),
ApproveDate datetime,
ApproveUsr varchar(50))
"Anith Sen" wrote:

> What is the datatype of the columns in the table? Do you have a default se
t
> for these columns, if the values are missing?Why not post the DDLs here? A
re
> you using OPENXML to load the data or using some other 3rd party tools?
> --
> Anith
>
>|||Your XML, as you posted in your initial post, is not well formed. It has no
closing tags for reimbursement node. The XML string has only eight values,
so it will insert values for only eight corresponding columns mentioned in
the INSERT statement. If the other columns are nullable, NULLs will enter
those columns. Here is the repro:
DECLARE @.x VARCHAR(500), @.idoc INT
SET @.x = '
<reimbursement>
<tbl_Reimbursement>
<Type10Rec Provider_Type="INSTIT" Provider_SubType="11" ReimDesc=""
Status="PMA" CreateUsr="Test" LastModDate="" LastModUsr="" ApproveDate=""/>
</tbl_Reimbursement>
</reimbursement>'
EXEC sp_xml_preparedocument @.idoc OUTPUT, @.x
INSERT INTO tbl
( Provider_Type, Provider_SubType, ReimDesc, Status,
CreateUsr, LastModDate, LastModUsr, ApproveDate, ApproveUsr )
SELECT * -- use column names
FROM OPENXML ( @.idoc, '/reimbursement/tbl_Reimbursement/Type10Rec', 1 )
WITH ( Provider_Type VARCHAR( 6 ),
Provider_SubType VARCHAR( 2 ),
ReimDesc VARCHAR( 70 ),
Status VARCHAR( 10 ),
CreateUsr VARCHAR( 50 ),
LastModDate DATETIME,
LastModUsr VARCHAR( 50 ),
ApproveDate DATETIME,
ApproveUsr VARCHAR( 50 ) )
EXEC sp_xml_removedocument @.idoc
Anith

Monday, February 20, 2012

Null How to handle

I already asked this question; however, I am giving all the details
now:

We get large files(millions of records) and we need to load it into our
tables using import export wizard. Some of the fields in the file can
be Null and so we are forced to create table with fields that allow
Nulls with default ''. However when we insert data into these tables
it puts Null in those fields even though we have a default '' (I do not
think we have any work around for that; do we?)

Finally we need to go through each field and update it to '' if it is a
Null and that takes LOT OF TIME.
If (select count (*) from <tablename> where <columname> is Null) >0
Begin
Update <tablename>
set <columnName> = ''
where <columnName> is Null
end

Please let me know if there are any work arounds for this crisis ?
Thank you very much in advance!gelangov@.hotmail.com wrote:
> I already asked this question; however, I am giving all the details
> now:
> We get large files(millions of records) and we need to load it into our
> tables using import export wizard. Some of the fields in the file can
> be Null and so we are forced to create table with fields that allow
> Nulls with default ''. However when we insert data into these tables
> it puts Null in those fields even though we have a default '' (I do not
> think we have any work around for that; do we?)

You can eliminate NULLs in the INSERT statement. If your original
statement was:

INSERT INTO DestTable
SELECT MyString, MyNumber, MyDate
FROM ImportFile

then you could rewrite this to:

INSERT INTO DestTable
SELECT COALESCE(MyString,''), COALESCE(MyNumber,0),
COALESCE(MyDate,'19000101')
FROM ImportFile

HTH,
Gert-Jan