-
SQL query help
I need to get the all the row for the value 11 from the below table. Could give me query for this.
create table teststring(a varchar(25))
insert into teststring
values('11:02,05:BL')
insert into teststring
values('16:03,11:RS')
insert into teststring
values('13:01,04:LL')
insert into teststring
values('16:05,11:RS')
drop table teststring
-
Are you asking how to find rows with the value "11" in it? If so, simply use the CharIndex() function.
-
--For all 11
select * from teststring where charindex('11',a)<>0
--For 11 in the first two character
select * from teststring where left(a,2)='11'
--For 11 after comma
select * from teststring where substring(a,7,2)='11'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|