Fetching records from attributes

How will you fetch records having underscore ( _ ) in the middle of of strings, from columns having attributes as "amit_6", "t_mit06", "am_06", "m_t", "j_x_t" ?

Questions by gajananamit

Showing Answers 1 - 45 of 45 Answers

sanjeev02

  • Mar 26th, 2009
 

The Exact Syntax would be:
select * from table where column like '%[_] %'

It would show all the items containin '_' in between.

  Was this answer useful?  Yes

prathima

  • Jul 22nd, 2009
 

use escape  keyword to fetch the strings with wildcard characters.
eg: select * from table_name where column_name like 'canara!_!_%' escape '!'

above query will return records with attribute value canara__



  Was this answer useful?  Yes

SELECT column_name FROM table_name                                                                                                           WHERE Charindex('_', Ltrim(Rtrim(column_name)))= (Len(Ltrim(Rtrim(column_name)))/ 2)+ 1

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions