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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 need help on like statement

Author  Topic 

Idyana
Yak Posting Veteran

96 Posts

Posted - 2012-05-05 : 12:56:35
My table and data as following,

declare @t1 table (chequeNo varchar(20))
insert into @t1 values('RHB 862291 (8)')
insert into @t1 values('RHB 862291 (27)')
insert into @t1 values('RHB 862291 (34)')

select upper(chequeNo) as chequeNo from @t1 where chequeNo like '%RHB 862'


Why no result was returned?

How to make it my SQL will return the result?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-05 : 13:41:06
because there are others characters also after the pattern

select upper(chequeNo) as chequeNo from @t1 where chequeNo like '%RHB 862%'


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Idyana
Yak Posting Veteran

96 Posts

Posted - 2012-05-05 : 17:44:44
tq sir
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-05 : 17:51:58
wc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -