CrazyEngineers
  • Insert Dashes In Between Numbers Using SQL

    Tehreemq

    Tehreemq

    @tehreemq-cbkGOh
    Updated: May 2, 2013
    Views: 1.3K
    Can anyone help with this???????. IF i have a ssn like 123459636 and i want to insert dashes into it how would i do that in SQL; i have tried but dint get Result like "123-45-9636". i got "-9636"
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Anoop Kumar

    MemberMay 2, 2013

    check this out..


    #-Link-Snipped-#

    like:
    SELECTSUBSTRING(ACCOUNTNUMBER,1,3)+'-'+SUBSTRING(ACCOUNTNUMBER,4,5)+'-'+SUBSTRING(ACCOUNTNUMBER,9,2)FROM BILLING.ACCOUNT
    and
    SELECTLEFT(ACCOUNTNUMBER,3)+'-'+SUBSTRING(ACCOUNTNUMBER,4,5)+'-'+RIGHT(ACCOUNTNUMBER,2)FROM BILLING.ACCOUNT
    Are you sure? This action cannot be undone.
    Cancel
  • Tehreemq

    MemberMay 3, 2013

    ok thank u...
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register