Home > database >  A text columns query out digital records
A text columns query out digital records

Time:11-16

Nvarchar column, enter the text and Numbers, and query the number of records

2
5
Text 33
Record 12 zhang
8
.
.


O: 2,5,8 records

CodePudding user response:

 
The create table # t (x nvarchar (50))

Insert into # t (x)
Select N '2' union all
Select N '5' union all
Select N '33 texts' union all
Select N 'record 12 zhang SAN' union all
Select N '8' union all
Select N '12'


Select the from x # t where isnumeric (x)=1

/*
X
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
2
5
8

(3 rows affected)
*/
  • Related