• Here is the definition of the Employee table from the AdventureWorks db. The output is formatted as displayed.

    Create View [dbo].[Employee]

    AS

    ( SELECT [EmpID]

    , [NAME]

    , [Salary]

    FROM [AdventureWorks2008R2].[dbo].[Employee]

    )

    GO

    As written, it uses the 3 part naming from the source table and uses the table name as is for the view name, which will not be valid while the table has the same name. Change the view name portion to fit your naming convention. For example to prefix the table name with a "v", add the v to the string containing the dot between the schema and table name, as below.

    QUOTENAME(c1.TABLE_SCHEMA) + '.v' + QUOTENAME(c1.TABLE_NAME)

    Wes
    (A solid design is always preferable to a creative workaround)