Why is the 'AS' table alias keyword required in Visual Studio (Database projects) Up till now I have been working directly on SQL Server instances, and am now playing around with how best to keep databases in source control. The visual studio database project seems to be exactly what I want.

However, on trying to build a fairly small database I get several hundred SQL71561 errors. The code is this:

CREATE VIEW [dbo].[View Name] AS
SELECT
    EA.colName,
    ...
FROM
    DbName.dbo.TableName EA


And the error is this:


  SQL71561: View: [dbo].[View name] contains an unresolved reference to an object. Either the object does not exist or the reference is ambiguous because it could refer to any of the following objects:
  [DbName].[dbo].[TableName].[colName] or [DbName].[dbo].[TableName].[EA]::[colName].


If I add an AS to the table alias, then the code seems to be accepted. It seems that column aliases are allowed to skip the 'AS' keyword.
I think this is happening because you're qualifying the database name in the query.

So remove **DBName** form the select clause; Visual Studio would then accept it.