October 3, 2016 at 11:50 am
How can we return rows where
select * from Address where Referral_Note1 is <numeric only>
Ones with Referral_Note1 = 00345677 must be returned
Ones with Referral_Note1 = 0034.5677 must NOT BE RETURNED
Ones with Referral_Note1 = 1. must NOT BE RETURNED
Not: Referral_Note1 is a varchar field.
October 3, 2016 at 12:04 pm
select * from Address where Referral_Note1 like '[0-9]'
That did it!
NO NEED TO REPLY TO THIS POST , AMEN!
October 3, 2016 at 12:24 pm
mw112009 (10/3/2016)
select * from Address where Referral_Note1 like '[0-9]'
That did it!
NO NEED TO REPLY TO THIS POST , AMEN!
Actually, if what you posted above works I wonder about your data. Please see the test below, the first is what you posted the second is what you are actually looking for based on your original post.
with TestData as (
select Refferal_Note1 from
(values ('00345677'),
('0034.5677'),
('1.')
)dt(Refferal_Note1)
)
select * from TestData where Refferal_Note1 like '[0-9]';
with TestData as (
select Refferal_Note1 from
(values ('00345677'),
('0034.5677'),
('1.')
)dt(Refferal_Note1)
)
select * from TestData where Refferal_Note1 not like '%[^0-9]%';
October 3, 2016 at 12:43 pm
Lynn brings up a good point, but what is the structure of your Referral_Note_1 column for all rows? Is there other text?
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply