Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Formating a SSN to 000-00-0000

Author  Topic 

JDrown
Starting Member

10 Posts

Posted - 2008-01-31 : 18:10:49
I have a report which uses SSNs and I need to format the SSN number into the traditional 000-00-0000 format.

Assume the following SSN number: 444-55-6666, how do I manage to get the correct format?

I know this is easy for the overwhelming majority of you, but I am relatively new to SQL Server, and need some help.

Thanks to all who reply!!

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2008-01-31 : 18:16:27
Do the formatting at the front end.

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

PravDev
Starting Member

1 Post

Posted - 2008-01-31 : 18:37:37

Below is the syntax to display the SSN in xxx-xx-xxxx format

substring(ssn,1,3) + '-' + substring(ssn,4,2) + '-' + substring(ssN, 6,4)

- Prav

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-01-31 : 23:01:50
Always better to do this at front end. What front end are you using?
Go to Top of Page
   

- Advertisement -