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]

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.

  • I agree with your views and i don't see any further advantages – TheGameiswar Mar 14 '17 at 11:48

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, privacy policy and cookie policy

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