Showing posts with label backwards. Show all posts
Showing posts with label backwards. Show all posts

Sunday, March 11, 2012

Backwards in a foreach for ADO?

I need to simulate cursor-type (groan) behavior in a dataset and am wondering if this is possible in the foreach task. Example - The user has the need to go through the data row-by-row, and if a certain value is missing in row 10 then go back to row 8, grab a value from that row, and plug it in the missing column in row 10. Then move on to row 11.

Is there a way to make the foreach ADO enumerator travel backwards? Is there a way to do this that will not be awfully inefficient? Any suggestions out there would be welcome.

I've advocated for set-based updates, and these simply aren't an option, as each successive row depends on the updates that may have happened above it in the sequence. Unless I hear of any other ideas out there I have to move forward with this sequential type operation.

This sounds like a script task to me... I don't believe that there is an effecient way to do this (if at all) with a for each loop...

|||

That's the headache I'm having - I don't see a good way to do this period, from a SQL/SSIS/relational perspective.

|||Not sure if this would meet your needs, but you can use a script transform to buffer rows. You'd have to create some structure to store the data in (an array or dataset would work) and then you can access the rows in any order you wish.|||

Sounds intriguing - do you happen to have an example handy?

backwards compatibility of the MDF file 2000 and 2005

I'm looking for information on if the SQL Database files are compatable between SQL 2000 and SQL 2005.

I know I can take a mdf from SQL 2000 and attach it to a SQL Server 2005 server and everyting works.

So the real quesiton is : Can I take a SQL Server database that started in SQL 2000, attach it to SQL Server 2005 and work with it, (including schema changes) and then attach it to a SQL Server 2000 server.

In the above scenario I'm keeping the compatability level at 8 (2000).

Does MS have any articals on this subject.

I need to know the limitations since the products I'm working on have to support both versions and so do our internal tools.

Thanks,

D

The MDF file format is different between SQL 2000 and 2005 and are not compatible. Compatability level affects the behavior of certain functionality, not the file format that SQL 2005 uses.

You should be able to write applications that can support both SQL 2000 and SQL 2005 without too much problem, but you will not be able to swap the actuall MDF file between the different versions.

Regards,

Mike Wachal
SQL Express

|||

I have been able to take a 2000 database and use it with SQL 2005 but not the other way around.

Are you saying that I should not be using a 2000 database on a 2005 server?

Thanks for the help

|||You can go from SQL2K to SQL2K5 but not the other way.