SSN Format query

SSN Format query

am 09.05.2006 22:08:59 von Parasyke

I have a query, here is a brief snipit:

SELECT Employment.PERSON_ID, Person.FIRST_NAME, Person.MIDDLE_NAME,
Person.LAST_NAME, Person.[SOCIALSECURITY#] AS SSN, ....

I want to return only the last 4 digits of the SSN. Can the below
snipit be incorporated into the above query?

something like: SET SSN = Right$(Replace(SSN,"-",""),5)

thanks!!!

Re: SSN Format query

am 10.05.2006 00:51:37 von MGFoster

Parasyke wrote:
> I have a query, here is a brief snipit:
>
> SELECT Employment.PERSON_ID, Person.FIRST_NAME, Person.MIDDLE_NAME,
> Person.LAST_NAME, Person.[SOCIALSECURITY#] AS SSN, ....
>
> I want to return only the last 4 digits of the SSN. Can the below
> snipit be incorporated into the above query?
>
> something like: SET SSN = Right$(Replace(SSN,"-",""),5)
>
> thanks!!!
>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Don't use the SET, just use the expression in the SELECT clause:

... Right(Person.[SOCIALSECURITY#],4) AS SSN, ....

Since the SSN has 4 numerals as the last 4 digits you don't need to get
rid of the dash "-" before plucking those numerals from the SSN.

--
MGFoster:::mgf00 earthlink net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBRGEc9YechKqOuFEgEQKXbwCfW78JlagWUWVVieoEqiwIIfBQuFQA niwp
LEXYO0C56REP6EM2ZSNQMgUo
=9laY
-----END PGP SIGNATURE-----