May 29, 2012 at 8:11 am
Hi,
I have a column(Datatype - char(100)) in my table in which i am saving alphanumeric values like 'AKN12345', 'REC12345'. All these values are uploaded by the user from an excel file. How can i check whether the values entered is in scientific notation or not.
Thanks in advance. !!
May 29, 2012 at 8:19 am
Kind of an odd requirement to check for scientific notation. Not sure there is exact but maybe something like this?
;with SomeVals (CharVal)
as (
select 'AKN12345' union all
select 'REC12345' union all
select '12.47e43' union all
select '12ee23' union all
select '123jg756' union all
select '837364.39485'
)
select CharVal, ISNUMERIC(CharVal) as Number, Case when ISNUMERIC(CharVal) = 1 and CharVal like '%e%' then 1 else 0 end as IsScientific
from SomeVals
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply