All Forums Database
barani_sachin 141 posts Joined 01/12
22 Feb 2012
Problem with an insert statement...

 

CREATE VOLATILE TABLE temp(cola VARCHAR(20),colb VARCHAR(20),dat1 DATE FORMAT 'ddmmyyyy',

dat2 DATE FORMAT 'ddmmyyyy')

 ON COMMIT PRESERVE ROWS;

 

When i tried inserting using the ODBC connection like this

 

INSERT INTO temp VALUES('a','b','01012000','05012000');  

 

its working.

 

 

But when i tried running the same in sert 

 

INSERT INTO temp VALUES('a','b','01012000','05012000');

 

in teradata.net connection in queryman

Its throwing an error!!!

 

What am i missing here??

 

ulrich 816 posts Joined 09/09
22 Feb 2012

most likely the date conversion fails - what is your error message?

feel free to donate bitcoin:12kgAUHFUqvG2sQgaRBXFhCwyf9HXdkGud

barani_sachin 141 posts Joined 01/12
22 Feb 2012

U r correct 'A character string failed conversion to a numeric vale'.  But why? Its working in ODBC and why not in Teradata.Net

ulrich 816 posts Joined 09/09
22 Feb 2012

I guess .net is handling conversions differently as ODBC.

But as you have a date column you should be save if you convert your string explicitly into a date in the insert. This will prevent you also from errors or the need to change code in case someone decides to change the date format in the table.

 

INSERT INTO temp VALUES('a','b',cast('01012000' as date format'ddmmyyyy'),cast('05012000' as date format'ddmmyyyy'));

feel free to donate bitcoin:12kgAUHFUqvG2sQgaRBXFhCwyf9HXdkGud

barani_sachin 141 posts Joined 01/12
22 Feb 2012

Yea you query works fine with Teradata.net connection... 

barani_sachin 141 posts Joined 01/12
22 Feb 2012

Thanks... Can you please tell me what are the major differences between a ODBC and Teradata.net connections..

You must sign in to leave a comment.