HoustonGuy
Programmer
I'm inserting rows into a table at specific spots. (A row of Data that is missing.)
The example below is silly, but this is what I need to do.
Example
-------
Row_id Column1
1 John Smith
2 Chicago
3 Illinois
I insert the address data. Now my table looks like this:
1 John Smith
1 123 Main St.
2 Chicago
3 Illinois
I need to be able to maintain the order correctly and reload into a new table. The issue is that sometimes SQL will insert the new address row above the name, (which technically came first.) I need the new table to populated correctly, like this:
1 John Smith
2 123 Main St.
3 Chicago
4 Illinois
I've tried adding a column with a counter and then repopulating the new table while sorting by the counter column, but it is still erratic. It boils down to the way SQL treats the simlar row_id's when processing. I also know that SQL inserts wherever it pleases, and we all must order by the row_id to maintain any type of structure - but I haven't found a fix for this yet.
Any insight is very much appreciated. Working with SQL 2008.
Thanks!
The example below is silly, but this is what I need to do.
Example
-------
Row_id Column1
1 John Smith
2 Chicago
3 Illinois
I insert the address data. Now my table looks like this:
1 John Smith
1 123 Main St.
2 Chicago
3 Illinois
I need to be able to maintain the order correctly and reload into a new table. The issue is that sometimes SQL will insert the new address row above the name, (which technically came first.) I need the new table to populated correctly, like this:
1 John Smith
2 123 Main St.
3 Chicago
4 Illinois
I've tried adding a column with a counter and then repopulating the new table while sorting by the counter column, but it is still erratic. It boils down to the way SQL treats the simlar row_id's when processing. I also know that SQL inserts wherever it pleases, and we all must order by the row_id to maintain any type of structure - but I haven't found a fix for this yet.
Any insight is very much appreciated. Working with SQL 2008.
Thanks!