BoulderBum
Programmer
I have a function that I want to test:
CREATE FUNCTION fnValidPass( @userN char(20), @pass char(16) )
RETURNS int
AS
BEGIN
declare @retVal int
IF @userN = null
set @retVal = 0
ELSE IF ( SELECT client_password FROM user_info WHERE client_user_name = @userN ) = @pass
set @retVal = 1
ELSE
set @retVal = 0
RETURN @retVal
END
And I tried to test in query anylizer like this:
DECLARE @result INT
DECLARE @name char( 20 )
DECLARE @pass char( 16 )
SET @name = "user1"
SET @pass = "test"
SET @result = dbo.fnValidPass(@name, @pass)
PRINT @result
but I get the following error messages:
Server: Msg 207, Level 16, State 3, Line 6
Invalid column name 'user1'.
Server: Msg 207, Level 16, State 1, Line 7
Invalid column name 'test'.
What is the proper way to pass strings as arguments?
CREATE FUNCTION fnValidPass( @userN char(20), @pass char(16) )
RETURNS int
AS
BEGIN
declare @retVal int
IF @userN = null
set @retVal = 0
ELSE IF ( SELECT client_password FROM user_info WHERE client_user_name = @userN ) = @pass
set @retVal = 1
ELSE
set @retVal = 0
RETURN @retVal
END
And I tried to test in query anylizer like this:
DECLARE @result INT
DECLARE @name char( 20 )
DECLARE @pass char( 16 )
SET @name = "user1"
SET @pass = "test"
SET @result = dbo.fnValidPass(@name, @pass)
PRINT @result
but I get the following error messages:
Server: Msg 207, Level 16, State 3, Line 6
Invalid column name 'user1'.
Server: Msg 207, Level 16, State 1, Line 7
Invalid column name 'test'.
What is the proper way to pass strings as arguments?