Exforsys
+ Reply to Thread
Results 1 to 8 of 8

SELECT Statement - Help

This is a discussion on SELECT Statement - Help within the SQL Server forums, part of the Database category; Hi, I am new into SQL, How to use SELECT statement to fetch records based on a partial match in ...

  1. #1
    nickole is offline Junior Member Array
    Join Date
    Feb 2006
    Answers
    7

    SELECT Statement - Help

    Hi,

    I am new into SQL, How to use SELECT statement to fetch records based on a partial match in a text field.

    Say for ex., I want to retrieve all names with has the "William" in any part of the name field. How to write a query for the above Scenario?

    Thanks in advance.


  2. #2
    bhv
    bhv is offline Junior Member Array
    Join Date
    Mar 2006
    Answers
    4

    Unhappy SQL Server 2005 Help

    hi. i am new to SQL server 2005. whenever i tried to create database through SQL sever Management studio, it asked me:
    server type: (here i select Database Engine)
    server Name : ( ??????????)
    Authentication : (Windows Authentiction is by default, another is SQL server Authentication, which one should i select?????????)

    i just have no idea what to do with server name. i have Internet Information Services (IIS) installed in my system.

    plsssssssssss help me.


  3. #3
    admin's Avatar
    admin is offline Administrator Array
    Join Date
    Mar 2005
    Location
    New York, USA
    Answers
    58
    Please read teh following tutorials on SQL Server 2005...

    http://www.exforsys.com/content/view/1616/356/1/1/


  4. #4
    chaudharyshamraiz is offline Junior Member Array
    Join Date
    Dec 2006
    Answers
    1
    Quote Originally Posted by nickole View Post
    Hi,

    I am new into SQL, How to use SELECT statement to fetch records based on a partial match in a text field.

    Say for ex., I want to retrieve all names with has the "William" in any part of the name field. How to write a query for the above Scenario?

    Thanks in advance.
    select ename from table name
    where ename like'%William%';
    write the table name from where u have to extract the data


  5. #5
    Angela is offline Member Array
    Join Date
    Apr 2006
    Answers
    85
    If a user wants to give the value only during run time then how can one handle the matching of pattern.


  6. #6
    neelu.payola is offline Junior Member Array
    Join Date
    Dec 2006
    Answers
    3
    is this u want

    SQL> create table ex(name char(20),id number);

    Table created.

    SQL> insert into ex values('&name',&id);
    Enter value for name: p will
    Enter value for id: 1
    old 1: insert into ex values('&name',&id)
    new 1: insert into ex values('p will ',1)

    1 row created.

    SQL> /
    Enter value for name: will g
    Enter value for id: 2
    old 1: insert into ex values('&name',&id)
    new 1: insert into ex values('will g',2)

    1 row created.

    SQL> /
    Enter value for name: p will g
    Enter value for id: 3
    old 1: insert into ex values('&name',&id)
    new 1: insert into ex values('p will g',3)

    1 row created.




    SQL> select * from ex where name like '%will%';

    NAME ID
    -------------------- ----------
    p will 1
    will g 2
    p will g 3


  7. #7
    cyrus is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    128
    nickole our friends have made a detailed resposne to your query.Did you try and did you get the result. Do update us.


  8. #8
    pegas is offline Junior Member Array
    Join Date
    Apr 2007
    Answers
    8
    Quote Originally Posted by Angela View Post
    If a user wants to give the value only during run time then how can one handle the matching of pattern.
    Let's say the value from your program comes in the param @name:

    CREATE PROC dbo.GetForAngela @name varchar(100)
    AS
    BEGIN

    SET @name = '%' + @name + '%'

    SELECT various_things
    FROM AngelasTable
    WHERE name LIKE @name

    END


    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...