Reputation: 89
SQL select attract but query I want to give the results as follows.
Select * from table where ???? Result
Upvotes: -5
Views: 50
Reputation: 1953
If I understood what you want .... this is how i would do it
if object_id('tempdb..#Temp') is not null drop table #Temp
create table #Temp (FirmName nvarchar(50))
insert into #Temp (FirmName)
values ('Emlak 17'),
('Sanane Emlak'),
('GE Emlak => Result'),
('45 Emlak'),
('Emlak 3Z'),
('Burak Emlak')
select * from #Temp
where Len(LEFT(FirmName, charindex(' ',FirmName, 0))) = 2
or LEN(RIGHT(FirmName,LEN(FirmName)-CHARINDEX(' ',FirmName))) = 2
Just copy paste it and give it a go ... let me know if that worked for you and please man, read the part "How to ask a question"
Upvotes: 0