locked
What does the '..' means in the following script? RRS feed

  • Question

  • What does the '..' means in the following script?

     

    INSERT INTO	dw..MarketingTargetFact (
    		DateKey, BranchKey, RetailGrossTarget, RetailNetTarget, BusinessGrossTarget, BusinessNetTarget)
    	SELECT 
    		d.DateKey, b.BranchKey, r.RetailGrossTarget, r.RetailNetTarget, r.BusinessGrossTarget, r.BusinessNetTarget
    	FROM
    		dw_staging..marketing_targets_raw r
    		INNER JOIN dw..DateDim d ON (r.YearMonth = d.ActualDate)
    		INNER JOIN dw..BranchDim b ON (r.BranchNumber = b.BranchNumber AND b.IsCurrent = 'Y')
    


    Tuesday, October 4, 2011 6:08 PM

Answers

  • Usually when you specify a table in a select including the server and database name it's servername.databasename.schemaname.tablename .  If you drop the servername it's just databasename.schemaname.tablename .  If you don't specify the schema name but you still specify the database name, the format is databasename..tablename .  In your example, dw is the databasename and MarketingTargetFact is the table/view name, but the schema name is not specified, so it's using the default schema.

     


    Eric Isaacs

    • Edited by Eric Isaacs Tuesday, October 4, 2011 6:15 PM
    • Proposed as answer by Naomi N Tuesday, October 4, 2011 6:20 PM
    • Marked as answer by jetq Tuesday, October 4, 2011 6:27 PM
    Tuesday, October 4, 2011 6:12 PM

All replies

  • It means default schema "DBO".

    Check following scripts:

    Select * From AdventureWorks..DatabaseLog -- Schema is dbo and will work fine
    Select * From AdventureWorks..Address --Sshema is Person and will return error

     


    Best Wishes, Arbi --- MCC 2011; Please vote if you find this posting was helpful or Mark it as answered.

    • Proposed as answer by Naomi N Tuesday, October 4, 2011 6:20 PM
    • Edited by Arbi Baghdanian Tuesday, October 4, 2011 6:22 PM
    Tuesday, October 4, 2011 6:10 PM
  • Usually when you specify a table in a select including the server and database name it's servername.databasename.schemaname.tablename .  If you drop the servername it's just databasename.schemaname.tablename .  If you don't specify the schema name but you still specify the database name, the format is databasename..tablename .  In your example, dw is the databasename and MarketingTargetFact is the table/view name, but the schema name is not specified, so it's using the default schema.

     


    Eric Isaacs

    • Edited by Eric Isaacs Tuesday, October 4, 2011 6:15 PM
    • Proposed as answer by Naomi N Tuesday, October 4, 2011 6:20 PM
    • Marked as answer by jetq Tuesday, October 4, 2011 6:27 PM
    Tuesday, October 4, 2011 6:12 PM