SQL Server Wild Chards

0
14

 

eg. table

 

create table students
(
st_id int primary key,
st_name varchar(100),
st_address varchar(max),
st_phone char(10)
)

 

insert into students select 1,’Abhilash’,’KOCHI’,’98400000′
insert into students select 2,’Sooraj’,’Thrissur’,’99000000′
insert into students select 3,’Roopjith’,’Kochi’,’974000000′
insert into students select 4,’Cimily’,’Thodupuzha’,’99610000′
insert into students select 5,’Sunit’,’Mumbai’,’9000000′
insert into students select 6,’Rakesh’,’Utterpradesh’,’9000000′

list all records starts either in s or a

select * from students where st_name like ‘[s,a]%’

start all which starts in any character but second charcter should be b and next onwards anything

select * from students where st_name like ‘_b%’

List all records which not starts in a and s

select * from students where st_name like ‘[^a,s]%’

List all starts in s and ends in k or t

select * from students where st_name like ‘s%[k,t]%’

List all starts in s and contain j or t in betwen

select * from students where st_name like ‘s%[j,t]%’

SHARE
Previous articleOutlook 2010 Keyboard Shortcut Keys
Next articleAccess GMail as Desktop Application
abhilash, is a programmer by profession and a technology addict with a passion towards browsing , shopping and imaging . My views may be biased on reviews. all images and videos are copyrighted to respective owners.

LEAVE A REPLY

Please enter your comment!
Please enter your name here