HumanResources.myTeam 示例表 (SQL Server)HumanResources.myTeam Sample Table (SQL Server)

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 是Azure SQL 数据库Azure SQL DatabaseYesAzure SQL 数据库Azure SQL Database 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance 是Azure Synapse AnalyticsAzure Synapse AnalyticsyesAzure Synapse AnalyticsAzure Synapse Analytics 是并行数据仓库Parallel Data Warehouseyes并行数据仓库Parallel Data Warehouse适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 是Azure SQL 数据库Azure SQL DatabaseYesAzure SQL 数据库Azure SQL Database 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance 是Azure Synapse AnalyticsAzure Synapse AnalyticsyesAzure Synapse AnalyticsAzure Synapse Analytics 是并行数据仓库Parallel Data Warehouseyes并行数据仓库Parallel Data Warehouse

导入和导出大容量数据 中的许多代码示例都需要一个名为 myTeam的具有特殊用途的测试表。Many of the code examples in Importing and Exporting Bulk Data require a special-purpose test table named myTeam. 您必须在 数据库的 HumanResources 架构中创建 myTeam AdventureWorks2012AdventureWorks2012 表,才能运行这些示例。Before you can run the examples, you must create the myTeam table in the HumanResources schema of the AdventureWorks2012AdventureWorks2012 database.

备注

AdventureWorks2012AdventureWorks2012 SQL Server 2019 (15.x)SQL Server 2019 (15.x)中的一个示例数据库。is one of the sample databases in SQL Server 2019 (15.x)SQL Server 2019 (15.x).

myTeam 表包含以下列 。The myTeam table contains the following columns.

Column 数据类型Data type 可空性Nullability 说明Description
EmployeeIDEmployeeID smallintsmallint 非空Not null 行的主键。Primary key for the rows. 我的工作组中成员的雇员 ID。Employee ID of a member of my team.
名称Name nvarchar(50)nvarchar(50) 非空Not null 我的工作组中成员的名称。Name of a member of my team.
标题Title nvarchar(50)nvarchar(50) NullableNullable 我的工作组中雇员的职位。Title the employee performs on my team.
背景Background nvarchar(50)nvarchar(50) 非空Not null 上次更新行的日期和时间。Date and time the row was last updated. (默认值)(Default)

创建 HumanResources.myTeamTo create HumanResources.myTeam

  • 使用以下 Transact-SQLTransact-SQL 语句:Use the following Transact-SQLTransact-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  
    

填充 HumanResources.myTeamTo populate HumanResources.myTeam

  • 执行下列 INSERT 语句以在表中填充两行: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  
    

    备注

    这些语句跳过第四列,即 Background列。These statements skip the fourth column, Background. 这样会有默认值。This has a default value. 跳过该列使 INSERT 语句将该列保留为空。Skipping this column causes this INSERT statement to leave this column blank.

另请参阅See Also

批量导入和导出数据 (SQL Server)Bulk Import and Export of Data (SQL Server)