Article
    C#
    ADO.Net
    .NET
    ASP.Net & Web Forms
    Custom Controls
    Web Development
    Exception Handling
    XML
    Database
    Security in .Net
    Testing
    Web Services
    Windows Services
    Windows Controls
    WCF
    AJAX
    WPF
    XAML
    Reporting
    Setup
    VB.Net
    LINQ
    JQuery
    SilverLight
    JavaScript
    HTML5
    Crystal Report
    Cloud Computing
    Share Point
    Visual C++
    MVC
    Android
    PHP
    Java
    HTML
    WordPress
    Joomla
    Products
    Drupal
    Windows Phone
    JSON
    LightSwitch
    iPhone/iPad
    Ruby on Rails
    IIS 7
    Windows 8
    CSS/CSS3
    Excel
    MS Access
    Shortcut Keys
    Visual SourceSafe
    Team Foundation Server
    API(s)
    Sencha-Touch
    Single Page App
    Bootstrap
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Top Contributor
Advertisement
Advertise with Us
Mindstick
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog

Home >> Database >> SQL Wildcards
SQL Wildcards
SQL Wildcards


by Arun Singh on 7/4/2011 2:44:11 PM

Views: 1852       Comments: 0

SQL Wildcards

SQL wildcards are used for searching one or more characters from table in a database. The SQL wildcards substitute one or more character, whenever there is a search for data in a table of the database. The Wildcards is must be used with LIKE operator. 

  There are many wildcards are used in SQL database, Here in which some important wildcards are given below:

1.     ‘%’ wildcards:

     ‘%’ allows you to match any string of any length that means a substitute for zero or more characters.

Example:    

Now we want to select the User whose name that starts with "ar" from the "userlogininfo" table.

 Select Query:    select username from userlogininfo where UserName like 'ar%' Output:

ArunKumar

Arunsingh

2.     ‘_’ wildcards:

‘_ ‘allows you to match on a single character that means ‘_’is looking for only one character.

 Example: 

 Now we want to select the user with a first name that starts with any character, followed by "runsingh" from the "userlogininfo" table.

 Select Query:  select username from userlogininfo where UserName like _runsingh'

Output:

                Arunsingh

3.     [charlist] wildcards:

[charlist] wildcards are used for any single character in charlist.

   Example:

Now we want to select the user with a name that starts with "a" or "v" from the "userlogininfo" table.

  Select Query:  select username from userlogininfo where UserName like '[av]%'

Output:

                ArunKumar

Arunsingh

Varunsingh

Report Abuse Form
Reason:    
 

Title :
Comment :
Text ColorBackground Color
BoldItalicUnderline
LeftCenterRightJustify
Ordered ListBulleted List
IndentOutdent
Horizontal Rule
SubscriptSuperscript
HyperlinkImage
Design ModeDesign
View HtmlHtml
     
 
Latest Article by Arun SinghRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Latest BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Top Viewed ArticlesRSS Feed
    
    
    
    
    
    
    
    
    
    
Top Viewed BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
Latest Interview QuestionsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Total Online Users: 3533
Advertisement
MindStick Cleaner
Advertise with Us
  
Copyright © 2009 - 2014MindStick. All Rights Reserved.