• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Fetching Max value from NVARCHAR column

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

How do I fetch the Max value of the data stored in a NVARCHAR column. Presently only numbers are stored in this column.
Max(AliasID) is not returning me the collect value.
Is there a way to fetch these numberic values from NVARCHAR col?
Now don't ask me why it was implemented that way...its an already existing system.

Thanks,
Neelima
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You seem certain that they are all numbers in the column. You can use to_number() function
to convert to numbers and get the max .

If by chance one is not a number , it will throw an invalid number error.

You might consider writing a small function to convert to a number and if it is
invalid number return a null or 0 ?

good luck,
Agad
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic