• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • Last Modified:

display format

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
1jaws
Asked:
1jaws
  • 2
  • 2
1 Solution
 
HainKurtSr. System AnalystCommented:
try:

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

XXXXXXX7832
0
 
leakim971PluritechnicianCommented:
SELECT LEFT(socsec, LEN(socsec) - 4 ) + RIGHT(socsec,4) FROM yourtable
0
 
HainKurtSr. System AnalystCommented:
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
 
leakim971PluritechnicianCommented:
;)
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now