Friday, February 24, 2012

Checking the type of a variable in SQL

Is there a way to check the type of a variable in SQL? I want to know
if a variable is a float or a string.

Thanks,
RamziHi

I assume you mean that you want to check the contents of a string to see if
it is a numeric value. There is a ISNUMERIC function (see books online) but
to avoid problems with comma being recognised as a decimal point then you
may want to use patindex instead and check for any character then is not 0-9
or decimal point. Such as http://tinyurl.com/45ejw

John

"Ramzi Abboud" <ramziabb@.gmail.com> wrote in message
news:a5617e65.0410261046.6f18c9f3@.posting.google.c om...
> Is there a way to check the type of a variable in SQL? I want to know
> if a variable is a float or a string.
> Thanks,
> Ramzi

No comments:

Post a Comment