|
|
|
The ISNUMERIC function in SQL60/65/70 checks for decimal & integer values. Hence characters like D, E are valid float representations & similarly ','. This is a simple logic that can check only for numeric digits without using a loop of any kind. |
Click here to copy the following block |
declare @c varchar(10) select @c = '12' + char(9) if exists(select * from (select 1 as digit union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10) as n where ascii(substring(@c, digit, 1 )) not between 48 and 57 ) print 'No' else print 'Yes'
if patindex( '%[^0-9]%' , @c ) > 0 print 'No' else print 'Yes' |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|