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
 GET LAST DIGITS FROM 10 DIGITS

Author  Topic 

paritosh
Starting Member

42 Posts

Posted - 2012-05-17 : 02:03:25
HI ALL ,

I WANT TO GET LAST VALUABLE DIGIT FROM 10 DIGIT NUMBER

ASSUME I HAVE A TABLE ABC COLUMN ID AND ID1

ID COLUMN HAVE VALUE
ID
1000000001
1000000002
.....
.....
1000000009
1000000010
......
......
1000000100

WHEN ID HAVE NUMBER THEN ID1 HAVE NUMBER GIVEN BELOW

ID ID1

1000000001 1
1000000002 2
..... .....
..... .....
1000000009 9
1000000010 10
...... .....
...... .....
1000000100 100

HOW TO GET ID1 COLUMN NUMBER FOR ABOVE STRUCTURE .

THANKS IN ADVANCE ........

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2012-05-17 : 02:25:23
if the id column is 1000000123 whats should be your id1 column?


Senthil Kumar C
------------------------------------------------------
MCITP - Database Administration SQL SERVER 2008
MCTS - Database Development SQL SERVER 2008
Go to Top of Page

airwala
Starting Member

1 Post

Posted - 2012-05-17 : 02:33:37
hi i am new to this forum.h
i am design a website in php i don;t know how to connect the database files with php?
how to connect a database in the project.
i know basics of sql
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2012-05-17 : 02:52:26
Try this


select '1000000100',convert(bigint ,RIGHT('1000000100',LEN('1000000100')-1))

Senthil Kumar C
------------------------------------------------------
MCITP - Database Administration SQL SERVER 2008
MCTS - Database Development SQL SERVER 2008
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2012-05-17 : 03:47:46
SELECT ID - 1000000000 AS ID1
FROM dbo.Table


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -