我有一个Questions
带有列的表Description
。它的列值是这样的:
This is First Heading,
1 This is Subheading one,
1.2 This is subheading Question
This is Second heading
2 This is subheading Two.
2.1 This is Subheading Question1
对于每一行,我如何确定其列值是否以数字 0-9 开头?
我有一个Questions
带有列的表Description
。它的列值是这样的:
This is First Heading,
1 This is Subheading one,
1.2 This is subheading Question
This is Second heading
2 This is subheading Two.
2.1 This is Subheading Question1
对于每一行,我如何确定其列值是否以数字 0-9 开头?
SELECT * FROM Questions WHERE Description LIKE '[0-9]%'
您可以使用以下查询。首先从左侧删除多余的空间并获得第一个左侧字符。如果不是数字,则此查询返回 0,否则返回 1。
Select ISNUMERIC(Left(Ltrim('1 This is Subheading'),1)) As Number
select true where cast(substring('1 This is Subheading', 1, 1) as int) between 0 AND 9
select * from TABLE_NAME where (YourColName like '0%' or YourColName like '1%' or YourColName like '2%' or YourColName like '3%' or YourColName like '4%' or YourColName like '5%' or YourColName like '6%' 或 YourColName like '7%' 或 YourColName like '8%' 或 YourColName like '9%')