Oracle-db2-sqlserver-mysql Database time conversion query table structure

Source: Internet
Author: User

ORACLE :

--Time Turn string

To_char (sysdate, ' Yyyymmddhh24miss ')

--String Turn time

Select To_date (' 20140701125751 ', ' Yyyymmddhh24miss ') from dual--2014-07-01 12:57:51

--Query table

SELECT * FROM all_tables WHERE table_name = ' {0} '

--Query column

SELECT

Aa.table_name as Tableename,

Aa.column_name as ColName,

NVL (Bb.comments, aa.column_name) as Coldesc

From

(

SELECT

TABLE_NAME,

COLUMN_NAME,

Comments

From

All_col_comments

WHERE

table_name = ' {0} '

and owner = ' {1} ') BB,

(

SELECT

TABLE_NAME,

COLUMN_NAME,

column_id

From

All_tab_columns

WHERE

table_name = ' {0} '

and owner = ' {1} ') AA

WHERE

Aa.column_name = Bb.column_name

ORDER by

aa.column_id ASC

DB2:

--Time Turn string

To_char (timestamp_expression, ' yyy-mm-dd HH24:MI:SS ')

--String Turn time

To_date (string_expression, ' yyy-mm-dd HH24:MI:SS ')

--Query table

SELECT * from SYSCAT. TABLES WHERE tabname = ' {0} '

--Query column

SELECT

TabName as Tableename,

ColName,

NVL (remarks, colname) as Coldesc

From

SYSCAT. COLUMNS

WHERE

TabName = ' {0} '

and Tabschema = ' {1} '

ORDER by

Colno ASC

Sql server:

--Time Turn string

Replace (replace (CONVERT (varchar, GETDATE (), 120), '-', '), ': ', '), ', ')

--String Turn time

Http://www.cnblogs.com/windphoenix/archive/2013/04/26/3044784.html

--Query table

SELECT * from sysobjects where xtype= ' U ' and name = ' {0} '

--Query column

Select Dbo.syscolumns.name as ColName, CONVERT (Varchar (), Isnull (Sys.extended_properties.value, Dbo.syscolumns.name)) as Coldesc from dbo.sysobjects inner join dbo.syscolumns on (dbo.syscolumns.id = Dbo.sysobjects.id ) left join sys.extended_properties on (dbo.syscolumns.id = sys.extended_properties.major_id and syscolumns.colid= sys.extended_properties.minor_id) where dbo.sysobjects.xtype= ' U ' and dbo.sysobjects.name = ' {0} '

Mysql:

---time-to-go string
Select Date_format (now (), '%y%m%d%h%i%s ')--20150425102256


--String Turn time
SELECT str_to_date (' 20150425102222 ', '%y%m%d%h%i%s '); --2015-04-25 10:22:22

--Query table

Selecttable_name as tablename,table_comment as Tabledesc Frominformation_schema.tables where table_name not like ' T ' ORDE R by TABLE_NAME;

--Query column

select* from information_schema.columns WHERE table_name = ' T ';

Sqlite:

--Time Turn string

Strftime ('%y%m%d%h%m%s ', ' Now ')

--String Turn time

http://blog.csdn.net/xmphoenix/article/details/6438854

Http://www.cnblogs.com/ungshow/archive/2010/10/10/1847081.html

--Query table

SELECT * fromsqlite_master where type= ' table ' Andname = ' {0} '

--Query column

PRAGMA Table_info ([T1])

Oracle-db2-sqlserver-mysql Database time conversion query table structure

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.