We make updates and additions to an item table in our test system, and we want to copy that table to the production system without taking production down. I tried to truncate the production item table and insert all of the rows from a temporary item table with the following commands:
truncate table item go insert item select * from item_tmp goThis works, but I have to take the production system down to use this. I was hoping to use a cursor and delete a row, then insert the corresponding row from the temp table so that only that item would be locked and I wouldn't have to take the production system down. In Oracle, I can declare a cursor and define a cursor record using the cursor_name%ROWTYPE, then I can delete the item in the production table and insert the current value of the cusor record. Sybase will only let you do updates and deletes with a cursor, no inserts. I also don't want to define each column from the table in the cursor, there are close to 100 columns in the table.
Actually I do not think this is the best way of dealing with this issue.
If you want effectively to use the test table "item" data as the production table all you need is to create a proxy table in production which will be the test table itself. In that case whatever happens to test table data (insert/update/delete) all will be reflected in the production real time. To clarify this point, the user will use the proxy "item" table in production which in reality will be your test table. This will avoid the issue of using cursors, etc., which are inefficient in both Sybase and Oracle. If you need more info please come back.
Dig Deeper on Linux servers
Related Q&A from Mich Talebzadeh
Sybase expert Mich Talebzadeh explains how to log on in ASE. Continue Reading
Sybase expert Mich Talebzadeh gives fifteen reasons for why Sybase will definitely be around for years to come. Continue Reading
Sybase expert Mich Talebzadeh explains the syntax for user-defined Sybase functions. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.