Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

AW: [SQL question]: type checking/conversion: msg#00242

db.maxdb

Subject: AW: [SQL question]: type checking/conversion

> sander hofstee wrote:
> >
> > Hi,
> >
> > I have a problem and I don't know if there is a solution, but I hope
> so:
> >
> > I have a VARCHAR column with alphanumeric-, numeric- and
date-values.
> > Depending on the value of another column I know the type of the
value
> > (alphanumeric-, numeric- or date-value).
> > When the type is a numeric value I need to cast it to a number, so
it
> > can be compared to another number.
> > But if it is not a numeric value that row has to be skipped even
> though
> > it can be in the resultset.It works fine when
> > there are only numeric values in the resultset. So I need to
> > differentiate between the numeric and other values.
> >
>
> Beside my personal opinion that storing different types of data in one
> column is not the best idea, try:
>
> Select col1, col2, ...,
> decode (other_column,
> value_meaning_col_is_number, num(col),
> 0) <--- or any other value for
> non-number-values
>
> see
>
http://dev.mysql.com/doc/maxdb/en/cf/63316bc03511d2a97100a0c9449261/fram
> eset.htm
>
> Elke
> SAP Labs Berlin
>

Ok, the above I did not test, try this (tested)

CASE
WHEN other_column = value_meaning_col_is_number
THEN NUM(col)
ELSE 0
END

Elke
SAP Labs Berlin

> > Is this possible?
> >
> > Greetings,
> >
> > Sander.
> >
> >
> > --
> > MaxDB Discussion Mailing List
> > For list archives: http://lists.mysql.com/maxdb
> > To unsubscribe:
> http://lists.mysql.com/maxdb?unsub=elke.zabach@xxxxxxx
>
>
> --
> MaxDB Discussion Mailing List
> For list archives: http://lists.mysql.com/maxdb
> To unsubscribe:
http://lists.mysql.com/maxdb?unsub=elke.zabach@xxxxxxx


--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe: http://lists.mysql.com/maxdb?unsub=gcdm-maxdb@xxxxxxxxxxx




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | advertise | OSDir is an inevitable website. super tiny logo