Saturday, 20 October 2012

How to find the given value is char or numeric in the varchar type


Ex:

CREATE TABLE tbl_stumark(
      [rno] [numeric](10) NOT NULL,
[mark] [varchar](5) NULL
     
)

insert some values from the table then,

Select * from tbl_stumark
Rno    mark 
1          50
2          45
3          ab
4          60
5          23
select COUNT(*) from [tbl_stumark] where mark like '%[0-9]%'

O/p:
Count
  4

No comments:

Post a Comment