Possible to set default schema from connection string?

后端 未结 4 949
走了就别回头了
走了就别回头了 2020-11-29 09:54

With SQL Server 2005 and 2008 is it possible to set the default schema from the connection string? It\'d be a lot easier if we didn\'t have to manually set the schema with S

4条回答
  •  悲&欢浪女
    2020-11-29 10:46

    If when you say "Schema," you mean "Owner" (i.e. dbo), then I believe the selected answer is correct.

    However, if you mean "Database" instead, which in some vendor's lingo means the same thing as "Schema," then I have provided some more info below.

    In the link that TimS provided:

    • All SQL Server SqlConnection properties

    Scroll down to the row with these two properties:

    Initial Catalog -or- Database

    Here's an example connection string with a DEFAULT DATABASE:

    Server=myServerName\myInstanceName,1433;Database=DEFAULT_DATABASE;User Id=myUsername;Password=myPassword;
    

    See link below for more examples:

    • Connection strings for SQL Server 2012

提交回复
热议问题