Solved

display format

Posted on 2011-09-06
4
182 Views
Last Modified: 2012-05-12
trying to display the soc. sec number on this format xxxxxxx1234  just the last four will show and front will show all xxx 's  .. how can I do that in tsql in my query?
0
Comment
Question by:1jaws
  • 2
  • 2
4 Comments
 
LVL 51

Accepted Solution

by:
HainKurt earned 500 total points
ID: 36493220
try:

declare @soc_number varchar(11) = '78326486324';
select right('XXXXXXXXXXX' + left(@soc_number,4),11)

XXXXXXX7832
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36493231
SELECT LEFT(socsec, LEN(socsec) - 4 ) + RIGHT(socsec,4) FROM yourtable
0
 
LVL 51

Expert Comment

by:HainKurt
ID: 36493235
leakim971, you need some coffee :)

declare @soc_number varchar(11) = '78326486324';
SELECT LEFT(@soc_number, LEN(@soc_number) - 4 ) + RIGHT(@soc_number,4)

78326486324
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36493238
;)
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sql join/ assign small # first 10 80
C# application error "Parameter Is Not Valid". 3 75
ADO.NET ENTITY DATA MODEL 3 30
Reset asp.net login password 4 24
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now