精品国产亚洲一区二区三区,男女作爱在线观看免费网站,欧美的又大又长做禁片A片,97国产精品人妻无码久久久

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

    當(dāng)未指定默認(rèn)值時(shí),允許將系統(tǒng)為當(dāng)前用戶的數(shù)據(jù)庫(kù)用戶名提供的值插入表內(nèi)。



    語(yǔ)法


    USER



    返回類型


    char



    注釋


    USER 提供與 USER_NAME 系統(tǒng)函數(shù)相同的功能。



    在 CREATE TABLE 或 ALTER TABLE 語(yǔ)句中將 USER 和 DEFAULT 約束一起使用,或者將 USER 作為任何標(biāo)準(zhǔn)函數(shù)使用。



    示例


    A. 使用 USER 返回當(dāng)前用戶的數(shù)據(jù)庫(kù)用戶名


    本示例聲明一個(gè) char 類型的變量,將 USER 的當(dāng)前值賦給它,然后打印該變量以及文本說(shuō)明。



    DECLARE @usr char(30)
    SET @usr = user
    SELECT 'The current user's database username is: '+ @usr
    GO


    下面是結(jié)果集:



    ----------------------------------------------------------------------- 
    The current user's database username is: dbo                  

    (1 row(s) affected)


    B. 將 USER 和 DEFAULT 約束一起使用


    本示例生成一個(gè)表,將 USER 用作銷售行的銷售員的 DEFAULT 約束。



    USE pubs
    GO
    CREATE TABLE inventory2
    (
    part_id int IDENTITY(100, 1) NOT NULL,
    description varchar(30) NOT NULL,
    entry_person varchar(30) NOT NULL DEFAULT USER
    )
    GO
    INSERT inventory2 (description)
    VALUES ('Red pencil')
    INSERT inventory2 (description)
    VALUES ('Blue pencil')
    INSERT inventory2 (description)
    VALUES ('Green pencil')
    INSERT inventory2 (description)
    VALUES ('Black pencil')
    INSERT inventory2 (description)
    VALUES ('Yellow pencil')
    GO


    下面是從表 inventory2 中選擇所有信息的查詢:



    SELECT * 
    FROM inventory2
    ORDER BY part_id
    GO


    下面是結(jié)果集(注意 entry-person 的值):



    part_id     description                    entry_person                   
    ----------- ------------------------------ -----------------------------
    100       Red pencil               dbo                  
    101       Blue pencil             dbo                  
    102       Green pencil             dbo                  
    103       Black pencil             dbo                  
    104       Yellow pencil             dbo                  

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