#1: SSN Format query
Posted on 2006-05-09 22:08:59 by 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!!!
Report this message |
#2: Re: SSN Format query
Posted on 2006-05-10 00:51:37 by 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 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBRGEc9YechKqOuFEgEQKXbwCfW78JlagWUWVVieoEqiwIIfBQuFQA niwp
LEXYO0C56REP6EM2ZSNQMgUo
=9laY
-----END PGP SIGNATURE-----
Report this message |