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.
Author |
Topic |
load1982
Starting Member
3 Posts |
Posted - 2008-07-20 : 17:44:11
|
Hope you can help me!!!!!!I have a number stored in a Variable, i want to make a select statement. and incrementing each row by one, starting from the number i have stored in the Variableexamble:Declare @ID intSet @ID=11220and with a select need to get something like this: ID Description11221 A11222 B11223 C11224 D11225 E |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-07-20 : 18:06:00
|
can't do it in a select in SQL Server 2000. you'll have to insert it into a temp table that has identity and then select from there.but this really is a presentation issue and you should handle that there._______________________________________________Causing trouble since 1980Blog: http://weblogs.sqlteam.com/mladenpSpeed up SSMS development: www.ssmstoolspack.com <- version 1.0 out! |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-20 : 18:31:04
|
[code]DECLARE @ID INTSET @ID = 11220SELECT Number + @ID AS ID, CHAR(64 + Number) AS DescriptionFROM master..spt_valuesWHERE Type = 'P' AND Number BETWEEN 1 AND 5[/code] E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|