Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have the following sp

create  PROCEDURe [dbo].[CHECKNAME]
     @USERNAME nvarchar(20)
     as
    SELECT userid
    FROM  dbo.user_password
    WHERE USERNAME='&'


when I run it as

execute dbo.CHECKNAME '&'


it gives me null. When I run the query
select userid
from dbo.user_password
where USERNAME='&'


it give me the actual result. Could anyone help me in this issue ?
Posted
Updated 16-Jan-11 16:07pm
v2

1 solution

your sp should be

create  PROCEDURE [dbo].[CHECKNAME]
     @USERNAME nvarchar(20)
     as
    SELECT userid
    FROM  dbo.user_password
    WHERE USERNAME=@USERNAME
 
Share this answer
 
Comments
TweakBird 16-Jan-11 22:58pm    
Good call.
7os7os 2-Feb-11 16:20pm    
CREATE PROCEDURe CHECKNAME
@USERNAME nvarchar(20)
as
SELECT userid
FROM user_password
WHERE username='@USERNAME'
this is the sp i think it 's the same u write still the problem
Yusuf 2-Feb-11 17:27pm    
They are not the same. I will leave it for you to figure out the difference.
HINT: Check WHERE clause.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900