Amazon

Monday, June 8, 2009

DB2 Basic Essentails

Listing the details(metadata) of a table.
SELECT * FROM SYSIBM.SYSCOLUMNS WHERE TBNAME = ‘MYTABLE’ AND TBCREATOR = ‘MYSCHEMA’ ORDER BY COLNO
where TBNAME is table name and TBCREATOR is schema name

Listing column name, column type, size, tablename of column of a table
SELECT name, coltype, length, tbname FROM SYSIBM.SYSCOLUMNS WHERE TBNAME = ‘MYTABLE’ AND TBCREATOR = ‘MYSCHEMA’ ORDER BY name

Selecting current date and current time
SELECT CURRENT DATE, CURRENT TIME FROM MYSCHEMA.MYTABLE

Using current date, current time in insert query
INSERT INTO MYSCHEMA.MYTABLE(MYDATE, MYTIME) VALUES (CURRENT TIME, CURRENT DATE)

No comments:

Post a Comment

Amazon Best Sellors

Weblogic - Server Creation - Issues

Datasource creation using python script.  Python Script was failing after creating Datasource. From UI Admin Console, if I try to activat...