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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 ints

Author  Topic 

Ex
Posting Yak Master

166 Posts

Posted - 2005-01-18 : 22:37:49
hey all,

just wondering if i had a int
DECLARE @a int
SET @a = 56

is there anyway to break it up into its units?

i.e i want to find out the 2nd number

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-01-18 : 23:32:01
DECLARE @a int
SET @a = 56
SELECT @a

SELECT SUBSTRING(CAST(@a AS VARCHAR(55)),2,1)


MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-01-19 : 00:11:46
or

DECLARE @a int
SET @a = 56
SELECT @a

SELECT SUBSTRING(ltrim(str(@a)),2,1)
Go to Top of Page

vganesh76
Yak Posting Veteran

64 Posts

Posted - 2005-01-19 : 05:35:17
DECLARE @a int
SET @a = 56
SELECT right(@a,1)

Enjoy working
Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2005-01-19 : 07:22:20
select a%10

Jay White
{0}
Go to Top of Page
   

- Advertisement -