Hi All,

i have table with some fields. one of them is "ID".
now i want to update ID by a given number.

suppose i have 5 rows and the ID are 1,2,3,4,5.
now i want that i should pass a parameter/number to the stored procedure
let it 10
then the table should contain ID as 11,12,13,14,15 after updation.
means given number should be added to all the IDs in the table.

how can i do this using stored procedure???


THANKS IN ADVANCE

Hi,

Create procedure adding
@number int
as
update tablename set id=id+@number

exec adding 10

Regards,
SrinivasaRao.Narra
Kongapadu.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.