Create view with specific owner

Posted on 2008-11-19
Last Modified: 2012-05-05
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
create view viewName as select field1 from ExistingdbName.dbo.tableName

use newDB
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?
Question by:stevengraff
    1 Comment
    LVL 15

    Accepted Solution

    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
    INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now