MIME-Version: 1.0 Content-Location: file:///C:/502CB117/phone_view.htm Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="us-ascii" ALTER VIEW dbo

 =

ALTER VIEW <= /span>dbo.vw_HomePhoneNumber<= o:p>

AS

 <= /o:p>

/*PURPOSE

Gets a list of home phone numbers with their party_id. This is us= ed to take the pieces of a phone number and concatenate them into a single string= .

 =

If the phone number fields are empty, it will return –- for that record.*/

 =

SELECT phone_use.party_id,

ISNULL(phone.area_code,'') + '= -'

+ <= span style=3D'color:blue'>ISNULL(phone.prefix,'')  + '-'

+ <= span style=3D'color:blue'>ISNULL(phone.suffix,'') +

CASE ISNULL(= phone.extension,'')

       W= HEN '' THEN ''

       E= LSE ' x' + phone.extension

END as rawhomephone=

FROM = phone=

join phone_use on phone.phone_id =3D phone_use.phone_id

WHERE phone_use.usage_type =3D 'home' and phone_use.party_type =3D '= person'