How to populate sequence here ?

Posted by Jasminej under Sql Server on 11/30/2012 | Points: 10 | Views : 766 | Status : [Member] | Replies : 5
I have created a table and populated some records. But, I missed to populate the serial number on RyotNo column.

How to populate sequence number on these 5 records(101 to 105) - LOOP should not be used here...!

Is there any simple UPDATE ?
RyotNo	RyotName	Phone
-----------------------------
NULL ABC1 12345
NULL EFG1 67890
NULL JKL1 13567
NULL MNO1 24680
NULL QWS1 67981
thank you




Responses

Posted by: Pandians on: 11/30/2012 [Member] [MVP] Silver | Points: 25

Up
0
Down
Check It Out!
Declare @Seq Int

Select @Seq = 100
Update TableName Set RyotNo = @Seq, @Seq = @Seq +1


Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Jasminej, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 11/30/2012 [Member] Starter | Points: 25

Up
0
Down
Thanq Pandians,
Itz working properly.

Thanks & Regards
Hari

Jasminej, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sourabh07 on: 12/3/2012 [Member] Starter | Points: 25

Up
0
Down
hi..Pandians


Thanks a lot...sir.


For introducing a new concept in my dictionary....

Sourabh07

Jasminej, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ogipansrk on: 12/5/2012 [Member] Starter | Points: 25

Up
0
Down
How it automatically increments...

Declare @Seq Int
Select @Seq = 100
Update TableName Set RyotNo = @Seq, @Seq = @Seq +1



Jasminej, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Manoj_B on: 12/5/2012 [Member] Starter | Points: 25

Up
0
Down
hii,

you can set RyotNo to identity yes(1,1). It automatically increments.


Thanks & Regards
Manoj Kumar

Jasminej, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response