2013-04-16 9 views

Odpowiedz

20

można używać symboli wieloznacznych: %

select * from table 
where name like '%BMW%' 
+0

jeśli chcę ciągnąć 'audi' & „BMW ' , jak mogę to zrobić ? – Uday

+1

Byłoby to: 'wybierz * z tabeli, gdzie nazwa taka jak"% BMW% "lub nazwa jak"% audi% "' –

2
select * from table where name like '%BMW%' 
3

Myślę, że szukasz czegoś jak

SELECT * FROM Table 
WHERE Column LIKE '%BMW%' 

folderze% są dzikie karty dla LIKE oświadczeniu.

Więcej informacji można znaleźć HERE

1

inny sposób ...

--Create Table 2 : 
Create Table #Table1 
(
    Roll_No INT, 
    Student_Address Varchar(200) 
) 
Go 

-- Insert Values into #Table1: 
Insert into #Table1 Values ('1','1st Street') 
Insert into #Table1 Values ('2','2rd Street') 
Insert into #Table1 Values ('3','3rd Street') 
Insert into #Table1 Values ('4','4th Road') 
Insert into #Table1 Values ('5','5th Street') 
Insert into #Table1 Values ('6','6th Street') 
Insert into #Table1 Values ('7','7th Street') 
Insert into #Table1 Values ('8','8th Wing') 

--Query 
Select * from #Table1 where CharIndex('Street',Student_Address) > 0 

--Clean Up: 
Drop table #Table1 
Powiązane problemy