Tag Archive for 'Database'

How to update Oracle column with sequence numbers

OracleI have a Oracle database table with some fields (columns) in numeric format. Now I need to update one column, namely store_id, to make it a primary column with unique number id. Since there were a lot of duplicate data in this column, the best way to do is to update this column with the sequence numbers.

To accomplish this, I need to create a sequence object in Oracle, and use Oracle cursor to loop and update the table column.

Here is the PL/SQL I used and worked.

DECLARE

Cursor store_id
IS
SELECT store_id FROM store_locations FOR UPDATE;

BEGIN

FOR c_store_id IN store_id LOOP
UPDATE cms_store_locations
SET store_id = store_seq.nextval
WHERE CURRENT OF store_id;

END LOOP;
commit;
END;
/

Related posts

How to move Microsoft SQL Server data to different disk drive

Microsoft SharePoint Server 2007Recently just re-installed the Microsoft Office SharePoint Server (MOSS) 2007 applications and database on new servers. But the SharePoint data files were in the C: system drive, which does not have enough space.

To move database files to the D: data drive, what I needed to do is

  1. Remove Content Database from the SharePoint Administrative Central.
  2. Deattch the database from Microsoft SQl server
  3. Move data files to the D: drive
  4. Re-attach the database
  5. Add Content Database to Web Application.

Related posts

How to export and import MySql database

image I have tried to re-configure the old web site log analyst tools – LiveStats XSP 6.2 for a long, long time. Finally I decided to wipe all of them and re-install again. To be safe, I have to back-up all MySql data (installed by LiveStats) first. Since the server is a Windows 2000, and I could not use web interface like Phpmyadmin. Well, I can copy all *.MYD files. But I found a better way by using the the following commands came with MySQL installation.
Continue reading ‘How to export and import MySql database’

Related posts



Get Adobe Flash playerPlugin by wpburn.com wordpress themes