Reputation: 3855
I need to check if a variable is a value 10.00 through 10.09. How can I do this by regex ?
IF SomeRegExFunction(@var, '10.0*')
print 'It worked'
Is there some way to do this?
Thanks
Upvotes: 0
Views: 1396
Reputation: 247880
You can use the following:
declare @var as varchar(10)
set @var = '11.07'
if @var like '10.0[0-9]'
print 'It worked'
else
print 'not a match'
Upvotes: 2
Reputation: 238296
SQL Server's like
as a simple expression syntax:
if @var like '10.0[0-9]' or @var = '10.0'
print 'Hello World!'
Upvotes: 1