Querying schema.table.column

  • I am testing on the AdventureWorks database (the OLTP version, not the data warehouse version).  This version has the 'dbo' schema and other schemas to.  I am trying to run a simply query and I get an error stating invalid object name 'HumanResources.Employee.BusinessEntityID'.  Here is the code:

    SELECT *
    FROM [HumanResources].[Employee].BusinessEntityID;

    This doesn't work either:

    SELECT *
    FROM [Employee].BusinessEntityID;

    When I run this code, I get a result set:

    SELECT *
    FROM [HumanResources].[Employee];

    1. Why does the first query not work?
    2. How can I query the BusinessEntityID column if these queries don't work?

    I am in the AdventureWorks2017 database.

  • Nevermind.  I see what I did wrong.  Only the schema and table should be in the FROM clause.  The column names should be in the SELECT statement.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply