Monday, February 20, 2012

my new function not found

I issue this command in QA:
CREATE FUNCTION encrypt_pair (@.data VARCHAR(14) , @.key char(30) )
RETURNS VARCHAR (60) AS
BEGIN
DECLARE @.encryptedvars VARCHAR(60)
EXEC master..xp_aes_encrypt @.data,@.key,@.encryptedvars OUTPUT
RETURN @.encryptedvars
END

If I run it again, I get an error that it already exists (duh).
Next I run:

select student_id, student_ssn,
encrypt_pair(student_ssn,'000000000000000000000000 00000000') from
student_ssn

and I get the error:
Server: Msg 195, Level 15, State 10, Line 1
'encrypt_pair' is not a recognized function name.
I don't get whats wrong!
Thanks
RobObject Owner...Object Owner

CREATE FUNCTION dbo.encrypt_pair (@.data VARCHAR(14) , @.key char(30) )
RETURNS VARCHAR (60) AS
BEGIN
DECLARE @.encryptedvars VARCHAR(60)
EXEC master..xp_aes_encrypt @.data,@.key,@.encryptedvars OUTPUT
RETURN @.encryptedvars
END

select student_id, student_ssn,
dbo.encrypt_pair(student_ssn,'00000000000000000000 000000000000') from
student_ssn

--
----------
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland

IM: mike@.epprecht.net

MVP Program: http://www.microsoft.com/mvp

Blog: http://www.msmvps.com/epprecht/

"rcamarda" <rcamarda@.cablespeed.com> wrote in message
news:1128344611.711934.195110@.g43g2000cwa.googlegr oups.com...
>I issue this command in QA:
> CREATE FUNCTION encrypt_pair (@.data VARCHAR(14) , @.key char(30) )
> RETURNS VARCHAR (60) AS
> BEGIN
> DECLARE @.encryptedvars VARCHAR(60)
> EXEC master..xp_aes_encrypt @.data,@.key,@.encryptedvars OUTPUT
> RETURN @.encryptedvars
> END
> If I run it again, I get an error that it already exists (duh).
> Next I run:
> select student_id, student_ssn,
> encrypt_pair(student_ssn,'000000000000000000000000 00000000') from
> student_ssn
> and I get the error:
> Server: Msg 195, Level 15, State 10, Line 1
> 'encrypt_pair' is not a recognized function name.
> I don't get whats wrong!
> Thanks
> Rob|||Thanks Mike, that thought never crossed my mind!

No comments:

Post a Comment