Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2005
    Posts
    3

    Unanswered: A simple varchar comparison

    First, Hi to all I'm new to this forum.
    Second, I don't know if standard SQL involves stored procedures, but anyway I'll post my doubt.
    I have chessy little procedure to get a password from a login. login is a varchar

    CREATE PROCEDURE getPassw
    @login as varchar
    AS
    SELECT T_Worker.pass
    FROM T_Worker
    WHERE T_Worker.login = @login

    If I try " exec getPassw 'abc' ", I never get anything. The data exists in the tables. If I do something like

    CREATE PROCEDURE getPassw
    /*@login as varchar*/
    AS
    SELECT T_Worker.pass
    FROM T_Worker
    WHERE T_Worker.login = 'abc'

    The password shows up : '456' .
    If I remove the '@' from the WHERE query, all columns are returned... ?!?!?
    I running the commands on a Microsoft's SQL server. Thank you for your attention. Any help would be seriously apreciated.
    Last edited by xErath; 01-05-05 at 13:04.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    This post really belongs in the Microsoft SQL forum.

    I think the only problem is that you didn't cut yourself enough rope... You need to make the parameter longer, like:
    Code:
    CREATE PROCEDURE getPassw 
       @login as varchar(50)
    AS
    
    SELECT T_Worker.pass
       FROM T_Worker
       WHERE T_Worker.login = @login
    
    RETURN
    -PatP

  3. #3
    Join Date
    Jan 2005
    Posts
    3
    AH!!! Something that simple... But it did work... Sorry not posting this in the right place

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •