Wednesday, April 22, 2009

SQL right, left Modulo

declare @a int, @b int, @c int, @d int
select @a = 568788
select @b = left(@a,3)
select @c = right(left(@a,3),2)
select @d = right(left(@a,3),2)%10
SELECT @b, @c, @d

--Output
568 68 8

No comments: