Union Character Data with Numeric data
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


Union Character Data with Numeric data Expand / Collapse
Author
Message
Posted 10/31/2007 6:27:39 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 10/31/2007 6:43:43 PM
Posts: 1, Visits: 3
Hi All,

I am trying to create a XML output by running a Teradata SQL . For this I need to have multiple Union sets in the query so that the order is maintained.
I need to have a lot of commented XML code in quotes just used as dummy select in my query. But down the blocks where the data fetch is required I am facing an issue.

I am trying to convert a numeric value fetched from the Database using the Cast function.
Eg:

Select XMLText from(
Select 1 XML Order , XMLText from (select cast(' ' as Varchar(3000)) XMLText ;) a
Union ALL
Select 2 XMLORder, cast (sum(units) as Varchar(30) XMLText

It throws an error 3617: FORMAT 'YYYY-MM-DD' does not match the datatype.

Please Help.
Post #9566
Posted 11/2/2007 4:47:08 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 6/25/2008 7:26:06 AM
Posts: 474, Visits: 202
I don't know about your case, but for any Set operations the first select determines the datatype and format of that column.

You should check if there's a Date column in your first select and cast it to Varchar.

Dieter
Post #9596
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 6:26pm

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.078. 10 queries. Compression Disabled.