Dear All,
Kindly help with me in the following scenario.
A table having following fields with following entries,
Id----Value----
5 ---- abcd
6 ---- efght
11--- ihjhnj
13--- ihjjkjk
But i want to replace the values of column ID with consecutive 1,2,3,4,5... ascending order numbers.
Is this possible? If so please help me...
Thanks and Regards,
Raj.
Use the "Row_Number()" function in your SQL Proc or query as a new field as shown here:
SELECT
ROW_NUMBER() OVER (ORDER BY [datActualDate] ASC) AS ROWID,
[datActualDate]
FROM
[Schema].[TableName]
April 20, 2010 at 11:58 pm
Dear Thomson, Thanks for reply.
PLease say me whether the following will be correct if i use your query with mine.
Select S.Id, S.Value, S.Id() Over (ORDER BY [datActualDate] ASC) AS ROWID,
[datActualDate]
FROM
[Schema].[TableName]) from SalesS
Will this be working for me ? for i got error like 'Syntax error near Order'
please as i am not so well versed with Query language, i am unable to interpret urs.
thanks a lot for ur patience,
April 21, 2010 at 12:57 am
I would like to see your full existing query however based on what you have posted;
Select SalesS.Id, SalesS.Value, ROW_NUMBER() Over (ORDER BY [SalesS.Id] ASC) AS RowID
FROM
SalesS
April 21, 2010 at 6:13 am
Hey Thomson U r great... ur query worked out for me...
Thanks a lot ...
If i could assign u points like other forum say me ... im unable to find where could i assign points to u..
Great work !! indeed 2 me ;o)
Thanks Thanks...
April 21, 2010 at 8:46 am
No problem, glad I could help... Glad I could return the help that many, many user's on this forum have given me!:-D
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply