You are currently browsing the Database category

Exporting and Importing in Oracle: A Quick Start

September 5, 2008 - 2:35 pm

I do this about twice per year and every time I have to look back at my notes to remember how. Maybe you are in the same boat. So, to save us both some trouble I’m going to blog my notes on the subject here.
exp schemaname/password@instance FILE=d:\mydump.dmp [follow instructions]
Give the file a name after FILE,…

Exporting and Importing in Oracle: A Quick Start - continue reading

1 Comment on Exporting and Importing in Oracle: A Quick Start

Optimize all tables in a database, Part 2

July 5, 2008 - 8:47 pm

Ok, not being satisfied with my first exploration of a global “do something” mysql script I asked the community for help.
The result is posted below, and here are the links that got me here.
http://www.linuxquestions.org/questions/showthread.php?p=2668261#post2668261
http://www.linuxforums.org/forum/linux-programming-scripting/85836-loop-within-loop-mysql-ops.html#post445403
Here is the final example script that optimizes (or replace optimize
with your favorite command like backup, alter table to InnoDB, etc.)
all tables…

Optimize all tables in a database, Part 2 - continue reading

Comment on Optimize all tables in a database, Part 2

Reformatting a text field in Microsoft Access to be a true date

July 5, 2008 - 8:24 pm

I had a text field (DATEOLD) with values like 20030526, that were dates in YYYYMMDD.
I needed these values to exist in a true datetime field in Microsoft
Access. So I created a new field called NEWDATE of the date/time type.
Then I ran the query below to convert the numbers.
UPDATE Itec_data1
SET [NEWDATE] = format(DateSerial (left([DATEOLD],4),…

Reformatting a text field in Microsoft Access to be a true date - continue reading

Comment on Reformatting a text field in Microsoft Access to be a true date

Selecting Date from a Mysql field in specific format

July 5, 2008 - 8:19 pm

I had a membership table with users and the datetime at which they
joined the site. I needed to get a count of members joining per month,
so I did this:

SELECT DATE_FORMAT( regdate, ‘%b %Y’ )
AS
MONTH , count( uid ) AS Users
FROM gl_users
GROUP BY MONTH LIMIT 0 , 30

Which resulted in
SQL result

Selecting Date from a Mysql field in specific format - continue reading

Comment on Selecting Date from a Mysql field in specific format

How to append tables in Mysql

July 5, 2008 - 6:58 pm

For those of you that have puzzled over how to append tables in Mysql like an Access ‘Append’ query, start here:
insert into table1 select * from table2;<br />

Where table1 and table2 are identical. This might fail if you use an auto-incrementing counter on both.

How to append tables in Mysql - continue reading

Comment on How to append tables in Mysql

SQL: My Oracle quick reference

July 5, 2008 - 6:52 pm

SET PAGESIZE 400
SET LINESIZE 120
SPOOL C:\TEMP\FILENAME.TXT
SPOOL OFF
ED
SAVE -> ALT-F4
/
SELECT * FROM TAB
SELECT MAX(LENGTH FIELDNAME) FROM TABLE
COLUMN FIELDNAME FORMAT A25 (FOR TEXT)

SQL: My Oracle quick reference - continue reading

Comment on SQL: My Oracle quick reference

Top