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
 General SQL Server Forums
 New to SQL Server Programming
 Insert New Data with Counters

Author  Topic 

mathmath
Starting Member

13 Posts

Posted - 2009-07-06 : 10:44:30
Hi, All
I encounter this problem when I am trying to insert some data manually for my project.
Example:
LA-R1, LA-R2 , LA-R5 , LA-R8 ….. [The Rs are Already in the Original Data]

Simply put, my Goal is to fill in the gaps between the Rs. So, the result will be like :
P = Parent, C=Child
PL CL
LA-R1 LA-2
LA-RI LA-R2

LA-R2 LA-3
LA-R2 LA-4
LA-R2 LA-5
LA-R2 LA-R5

LA-R5 LA-6
LA-R5 LA-7
LA-R5 LA-8
LA-R5 LA-R8

LA-R8………….[b]

I hope I explain well enough this time.
I know I can declare a counter to update the data. However to insert new rows of data, im not sure how I can do that. Please Help.

Thanks very much.


X002548
Not Just a Number

15586 Posts

Posted - 2009-07-06 : 12:59:47
fill in with what?

Just empty rows with a key?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

mathmath
Starting Member

13 Posts

Posted - 2009-07-07 : 03:39:54
quote:
Originally posted by X002548

fill in with what?

Just empty rows with a key?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam








I am sorry for the confusion , because it is very complicated to me.
Example:
ID NUMBERS
1 2
2 4
3 7
4 9

All I am trying to do is: Fill in the Gaps between the numbers.
Result will be :
ID Numbers
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9

If this makes sense.
Thanks again.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-08 : 12:05:00
do you want id value to change as per correct order of numbers also?
Go to Top of Page
   

- Advertisement -