GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Database  >  SQL Server
Go To First  |  Previous Question  |  Next Question 
 SQL Server  |  Question 95 of 99    Print  
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" ?


  
Total Answers and Comments: 10 Last Update: November 02, 2009     Asked by: gajananamit 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
January 05, 2009 01:50:48   #1  
ra.shinde Member Since: January 2009   Contribution: 2    

RE: Fetching records from attributes
Use Like ' _ '
 
Is this answer useful? Yes | No
February 04, 2009 14:43:27   #2  
cybersavvy Member Since: February 2009   Contribution: 16    

RE: Fetching records from attributes
select col_name from table_name where col_name like ' _ ' Escape ''
 
Is this answer useful? Yes | No
February 05, 2009 10:09:14   #3  
cybersavvy Member Since: February 2009   Contribution: 16    

RE: Fetching records from attributes
select colname from table_name where colname like ' _ ' Escape ''
 
Is this answer useful? Yes | No
March 24, 2009 18:07:23   #4  
Lani_dba Member Since: March 2009   Contribution: 1    

RE: Fetching records from attributes
select * from table where column like '[_] '
 
Is this answer useful? Yes | No
March 26, 2009 02:58:18   #5  
sanjeev02 Member Since: March 2009   Contribution: 2    

RE: Fetching records from attributes
The Exact Syntax would be:
select * from table where column like ' [_] '

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

 
Is this answer useful? Yes | No
July 22, 2009 08:05:07   #6  
prathima Member Since: October 2005   Contribution: 2    

RE: Fetching records from attributes
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__




 
Is this answer useful? Yes | No
September 23, 2009 08:29:29   #7  
goksn Member Since: May 2009   Contribution: 94    

RE: Fetching records from attributes
select * from table_name where column_name like ' _ '
 
Is this answer useful? Yes | No
October 06, 2009 04:15:41   #8  
dh09121975 Member Since: October 2009   Contribution: 1    

RE: Fetching records from attributes

SELECT * FROM table
WHERE Column LIKE ' [_] '


 
Is this answer useful? Yes | No
October 21, 2009 05:35:38   #9  
balaji.psnacet Member Since: October 2009   Contribution: 1    

RE: Fetching records from attributes

Try this ..
SELECT * FROM table_name WHERE column_name LIKE' !_ ' ESCAPE '!'


 
Is this answer useful? Yes | No
November 02, 2009 00:17:21   #10  
Bhuvaneswari.V Member Since: November 2008   Contribution: 5    

RE: Fetching records from attributes
SELECT * FROM TableName WHERE ColumnName LIKE '_ [_] _'
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape