If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Referencing data type

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-22-04, 12:24
Prabhu Gopalan Prabhu Gopalan is offline
Registered User
 
Join Date: Apr 2004
Posts: 1
Referencing data type

I want to CAST a varible to the datatype of a column from table.

That is,

CAST(VbleName AS tablename.columnname.datatype)

I can do CAST(VbleName AS Integer). The reasons I don't want to do like that are,

1. In future if the type of column change I have to goback and change all these codes.
2. While coding, I have full the respective table def. to findout what the respective data type is.

Do any know how to do this??

Thanks for your help.

--Prabhu.
Reply With Quote
  #2 (permalink)  
Old 04-22-04, 15:10
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Re: Referencing data type

You cannot do this in plain SQL ...

But I think, if you use, JDBC etc, you can build the query dynamically and make use of the new column datatype

HTH

Sathyaram

Quote:
Originally posted by Prabhu Gopalan
I want to CAST a varible to the datatype of a column from table.

That is,

CAST(VbleName AS tablename.columnname.datatype)

I can do CAST(VbleName AS Integer). The reasons I don't want to do like that are,

1. In future if the type of column change I have to goback and change all these codes.
2. While coding, I have full the respective table def. to findout what the respective data type is.

Do any know how to do this??

Thanks for your help.

--Prabhu.
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On