Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 HOW TO SEARCH T-SQL KEYWORDS

Author  Topic 

yaman
Posting Yak Master

213 Posts

Posted - 2008-04-10 : 06:17:50
I WANT TO FIND THAT WORD WHICH IS START'S FROM % KEYWORD

SELECT ENAME FROM TABLENAME WHERE ENAME LIKE '%%'

HOW CAN I FIND PLS HELP ME OUT .



Yaman

rengal
Starting Member

8 Posts

Posted - 2008-04-10 : 06:27:03
Select ENAME
From TABLENAME
WHERE ENAME like ' ';

Put % at start if the word you want is at the end and vice versa
You can use _ as any letter also e.g. '_ _ _ _ word'
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-04-10 : 06:35:03
i think you mean where there is literally a % in the string? and its getting confused with the wildcard characters?

if so try this example...


declare @t table (col varchar(10))
insert into @t
select '%hello'
union all select 'hello'


select * from @t
where col like '|%%' escape '|'



Em
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-04-10 : 06:51:17
[code]DECLARE @t table (col varchar(10))

insert into @t
select '%hello'
union all select 'hello'
union all select 'hel%lo'

select * from @t
where col like '|%%' escape '|'

-- Peso
select * from @t
where col like '%[%]%'[/code]


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -