HumanResources.myTeam Sample Table

HumanResources.myTeam Sample Table (SQL Server)

 

Many of the code examples in Importing and Exporting Bulk Data require a special-purpose test table named myTeam. Before you can run the examples, you must create the myTeam table in the HumanResources schema of the AdventureWorks2012 database.

System_CAPS_ICON_note.jpg Note


AdventureWorks2012 is one of the sample databases in SQL Server 2014.

The myTeam table is contains the following columns.

ColumnData typeNullabilityDescription
EmployeeIDsmallintNot nullPrimary key for the rows. Employee ID of a member of my team.
Namenvarchar(50)Not nullName of a member of my team.
Titlenvarchar(50)NullableTitle the employee performs on my team.
Backgroundnvarchar(50)Not nullDate and time the row was last updated. (Default)

To create HumanResources.myTeam

  • Use the following Transact-SQL statements:

    --Create HumanResources.MyTeam: 
    USE AdventureWorks;
    GO
    CREATE TABLE HumanResources.myTeam 
    (EmployeeID smallint NOT NULL,
    Name nvarchar(50) NOT NULL,
    Title nvarchar(50) NULL,
    Background nvarchar(50) NOT NULL DEFAULT ''
    );
    GO
    
    

To populate HumanResources.myTeam

  • Execute following INSERT statements to populate the table with two rows:

    USE AdventureWorks;
    GO
    INSERT INTO HumanResources.myTeam(EmployeeID,Name,Title,Background)
       VALUES(77,'Mia Doppleganger','Administrative Assistant','Microsoft Office');
    GO
    INSERT INTO HumanResources.myTeam(EmployeeID,Name,Title,Background)
       VALUES(49,'Hirum Mollicat','I.T. Specialist','Report Writing and Data Mining');
    GO
    
    
    System_CAPS_ICON_note.jpg Note


    These statements skip the fourth column, Background. This has a default value. Skipping this column causes this INSERT statement to leave this column blank.

Bulk Import and Export of Data (SQL Server)

Show:
© 2016 Microsoft