Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

Create view with specific owner

I'm distributing an application commercially, I hope. My installer needs to create a SQL database (called newDB), tables, functions,  and views.

Which is better:

use newDB
go
create view viewName as select field1 from ExistingdbName.dbo.tableName
or

use newDB
go
create view viewName as select field1 from ExistingdbName..tableName

I know that under most circumstances the result is the same, but I don't want to be sloppy about it by making that assumption. Should my installation program ask the user for the owner of ExistingdbName? with a default to dbo?
0
stevengraff
Asked:
stevengraff
1 Solution
 
MohammedUCommented:
It will not ask the db owner but definitely object owner...
In this case View...
I will adivise you use schema name when you are creating the objects like view/table etc...

create view dbo.viewName as select field1 from ExistingdbName.dbo.tableName
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now