0

I currently have to take over an old project and found a single view that's kind of a special snowflake because it's declared this way:

USE [DbName]
GO

create view [abc].[vXyz] as
select id, name, etc
from [DbName].[abc].[xyz]

Is there any good reason to do this? Only thing I could maybe think of is that this view is/was maybe also accessed from another database and whoever wrote it thought they would need to declare it this way to work properly, but as far as I'm aware it's not.

1
  • I agree with your views and i don't see any further advantages Commented Mar 14, 2017 at 11:48

1 Answer 1

1

There is no need to specify the database if the view is in the same database. And the view will work even if it is referenced by a different database.

So no no good reason of specifying the database when you are in the same database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.