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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Updates between ids after select

Author  Topic 

jtrumbul
Starting Member

11 Posts

Posted - 2009-01-09 : 17:45:13
Hello All,

I have a question that may be simple or may be hard as hell since my sql knowledge is < 0 to say the least ill let it rip.

I have a select statement which returns the following rows and cols

PriKey EmpName
3 Abraham Pineda
6 Al Vincent Amisola
10 Albert Welcher
13 Amity Payne
16 Andrew Montero
19 Annie Rothermel

what i need to do is update this record set where i take the first 2 ids, and update all rows inbetween 3 + 1 and 6 - 1 then do the same for 6 and 10 then 10 and 13 etc... i need to update all the rows as stated in the same way putting the value of empname in each updated row with the exception of prikey 2 - 1 so for example with 6 and 10 i need to update rows 7,8,9 is there some simple way to do this?

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-01-09 : 17:51:46
Can you post Sample data and Expected output?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-10 : 02:53:12
do you have records with id's 7,8,9 ,.. in your table or do you want to create them? i cant see them in sample data posted
Go to Top of Page

jtrumbul
Starting Member

11 Posts

Posted - 2009-01-12 : 10:35:33
Is there some way i can add an attachment to a post. The thing is first i am importing an excel spread sheet then in the table it creates i have to do what i described before with the data, if there is some way to attach files, i will attach the spread sheet and the table it creates, i think this will give alot more light to what im trying to accomplish.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-12 : 10:37:26
yup...upload the picture in some shared server and post path between image tags
Go to Top of Page
   

- Advertisement -