CURRENT_TIMESTAMP CURRENT_TIMESTAMP - 北京怡康軟件科技有限公司 資源網(wǎng) "/>

中文字幕天天躁日日躁狠狠躁,最近中文字幕大全免费版在线,最近2019免费中文字幕视频三,亚洲精品无码你懂的,亚洲国产精品成人精品小说

  • 相關(guān)軟件
    >CURRENT_TIMESTAMP 創(chuàng)建者:webmaster 更新時(shí)間:2006-02-16 15:51

    返回當(dāng)前的日期和時(shí)間。此函數(shù)等價(jià)于 GETDATE()。



    語(yǔ)法


    CURRENT_TIMESTAMP



    返回類型


    datetime



    示例


    A. 使用 CURRENT_TIMESTAMP 返回當(dāng)前的日期和時(shí)間


    下面的示例返回 CURRENT_TIMESTAMP 的值和一個(gè)文本描述。



    SELECT 'The current time is: '+ CONVERT(char(30), CURRENT_TIMESTAMP)


    下面是結(jié)果集:



    --------------------------------------------------- 
    The current time is: Feb 24 1998 3:45PM        

    (1 row(s) affected)


    B. 將 CURRENT_TIMESTAMP 用作 DEFAULT 約束


    下面的示例創(chuàng)建一個(gè)表,該表針對(duì)銷售行的 sales_date 列將 CURRENT_TIMESTAMP 用作 DEFAULT 約束。



    USE pubs
    GO
    CREATE TABLE sales2
    (
    sales_id int IDENTITY(10000, 1) NOT NULL,
    cust_id int NOT NULL,
    sales_date datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    sales_amt money NOT NULL,
    delivery_date datetime NOT NULL DEFAULT DATEADD(dd, 10, GETDATE())
    )
    GO
    INSERT sales2 (cust_id, sales_amt)
      VALUES (20000, 550)


    下面的查詢從 sales2 表中選擇所有信息。



    USE pubs
    GO
    SELECT *
    FROM sales2
    GO


    下面是結(jié)果集:



    sales_id    cust_id    sales_date          sales_amt delivery_date               
    ----------- ---------- ------------------- --------- -------------------
    10000     20000     Mar 4 1998 10:06AM 550.00   Mar 14 1998 10:06AM

    (1 row(s) affected)
    相關(guān)文章
    本頁(yè)查看次數(shù):