Groups | Blog | Home
all groups > sql server new users > june 2006 >

sql server new users : problem with like


Tom Moreau
6/12/2006 3:00:31 PM
Try:

select
*
from
@tab
where
vc like '10.1.[0-9]'

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
..
[quoted text, click to view]
SET NOCOUNT ON

declare @tab table(vc varchar(2000))
insert into @tab select '10.1'
insert into @tab select '10.1.1'
insert into @tab select '10.1.2'
insert into @tab select '10.1.1.1'
insert into @tab select '10.1.1.1.1'

The problem is that i need to select only 10.1.1 and 10.1.2 when i put input
as 10.1
If I give input as 10.1 , it should select only records 10.1.1 and 10.1.2

I tried this but not working
SELECT * FROM @Tab WHERE vc like '10.1.[^.]%'


aneeshattingal
6/12/2006 11:19:09 PM
SET NOCOUNT ON

declare @tab table(vc varchar(2000))
insert into @tab select '10.1'
insert into @tab select '10.1.1'
insert into @tab select '10.1.2'
insert into @tab select '10.1.1.1'
insert into @tab select '10.1.1.1.1'

The problem is that i need to select only 10.1.1 and 10.1.2 when i put input
as 10.1
If I give input as 10.1 , it should select only records 10.1.1 and 10.1.2

I tried this but not working
SELECT * FROM @Tab WHERE vc like '10.1.[^.]%'


AddThis Social Bookmark Button