[Informix][SQL]Table 新建/Create、刪除、清資料,其中DateTime型別欄位指定從年到秒(From Year to Second),帶預設值

  • 3606
  • 0
  • 2018-04-03

.

Create Table: 

create table Table1 (
column1 char(14) not null, 
column2 datetime year to second );

------或---------------------------------
create table Database1@Server1:Table1 (
column1 char(14) not null, 
column2 datetime year to second );

------或---------------------------------
create table Database1:Table1 (
column1 char(14) not null, 
column2 datetime year to second );

DateTime欄位預設值,參考: 

CREATE TABLE myTable (
    start_time DATETIME YEAR TO FRACTION NOT NULL DEFAULT
               DATETIME(0001-01-01 09:00:00.000) YEAR TO FRACTION,
    end_time   DATETIME YEAR TO FRACTION NOT NULL DEFAULT
               DATETIME(0001-01-01 17:00:00.000) YEAR TO FRACTION,
    daily_max  INT NOT NULL,
    …some other columns…
)

Clear Table Data:

Truncate Table Table1;

---------或-----------------------------
Truncate Table Database1@Server1:Table1;

Drop Table:

Drop Table Table1;

-------或--------------------------
Drop Table Database1@Server1:Table1;