1. Query table structure;
DB2: select colname, typename, length from syscat.columns where tabname = 'EVT'; MSSQL: select a.name, b.name, a.length from syscolumns a, systypes b where a.xtype = b.xtype and a.id = object_id('EVT'); Oracle/Mysql: desc tablename;
Oracle:
select COLUMN_NAME,DATA_TYPE from USER_TAB_COLS where TABLE_NAME='MCCOMP_CONFIG';
2. Get first N rows;
Mysql: select * from phone limit N Oracle: select * from phone where rownum < N DB2: select * from phone fetch first N rows only MSSQL: select top N * from phone
3. Execute sql scripts via command line;
DB2: db2 -tvf filename;
4. Export ddl of a table:
DB2: db2look -d dbname -e -o phone.txt -t phone -i dmtx -w abcd1234
5. Export and import of db data:
db2move rctec export -u dmtx -p abcd1234 [-tn phone] db2move cteclc import -u viacom -p abcd1234
6. Connect to MSSQL;
sqlcmd -S/SQLEXPRESS -d dbname -U username -P abcd1234
7. Sybase
query stored procedure:
select name, uid, type from sysobjects where type='P' and name like '%empplan%'