SQL Server 2008 - Number Manipulation
-
Hi All, I'm very new to SQL Server 2008, and need a bit of help manipulating numbers. I've got a int column holding numbers up to 11 digits. I need to do the following manipulation and use it in a SQL query. Basically, the first digit is transfered to the 3rd position on the right side. 12345678 23456178 or 1234 2134 The values are variable, there are even records with only a value of 1. Thanks in advance.
-
Hi All, I'm very new to SQL Server 2008, and need a bit of help manipulating numbers. I've got a int column holding numbers up to 11 digits. I need to do the following manipulation and use it in a SQL query. Basically, the first digit is transfered to the 3rd position on the right side. 12345678 23456178 or 1234 2134 The values are variable, there are even records with only a value of 1. Thanks in advance.
-
Hi All, I'm very new to SQL Server 2008, and need a bit of help manipulating numbers. I've got a int column holding numbers up to 11 digits. I need to do the following manipulation and use it in a SQL query. Basically, the first digit is transfered to the 3rd position on the right side. 12345678 23456178 or 1234 2134 The values are variable, there are even records with only a value of 1. Thanks in advance.
-
Hi, How about...
declare @value varchar(11) set @value = cast(12345678 as varchar) select cast(substring(stuff(@value, len(@value)-1, 0, substring(@value,1,1)), 2, len(@value)) as int)
Ryan