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)
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