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
 General SQL Server Forums
 New to SQL Server Programming
 SSCC Number

Author  Topic 

octa8on
Starting Member

1 Post

Posted - 2007-01-18 : 08:06:59
Hello,

I have a problem with SSCC number. The number is 18 digits long, and I want to see only the last 11 digits, as the first 7 digits always remain constant. I am pulling data from a DB and the sql query used is as follows:

"SELECT GDAEREP.AEADDT, GDAEREP.AEADST, GDAEREP.AEAEDT, GDAEREP.AEAJNB, GDAEREP.AEAZCD
FROM S44E0169.LGDIBLOBJ.GDAEREP GDAEREP"

where GDAEREP is the table name and AEAZCD is the field which contains the sscc number. Anyone can help how to get back only the last 11 digits please??

Eg:999999900100002855 into 00100002855.

Thanks
octa8on

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-01-18 : 08:13:05
[code]SELECT GDAEREP.AEADDT, GDAEREP.AEADST, GDAEREP.AEAEDT, GDAEREP.AEAJNB, Right(GDAEREP.AEAZCD, 11) as AEAZCD
FROM S44E0169.LGDIBLOBJ.GDAEREP GDAEREP[/code]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -