I have a SQL Server 2008 database that uses a default schema called "Arxame". How do I specify or change the default schema from "dbo" to "Arxame" in my connection string? I'm using C# and ADO.NET.
The initial schema must be set in your connection string:
Data Source=localhost;Initial Catalog=Arxame;Integrated Security=True
Remember to use Integrated security only if you are using a Local Sql Server.
The InitialCatalog is indeed the database name. The schema that is used would depend on the user you specify, since schemas typically map to database users. Whatever user owns the Arxame schema is the one you should specify in the connection string.
You can't do that. You have to set the schema "Arxame" to the user you have specified on your connection string. You can do this using the SQL Server Management tool
If you need to change the default schema for an existing user you can do it like this
B. Changing the default schema of a user
The following example changes the default schema of the user Mary51 to Purchasing.
USE AdventureWorks2008R2;
ALTER USER Mary51 WITH DEFAULT_SCHEMA = Purchasing;
GO
Source: MSDN
I do not believe you can do this within a connection string, nor should you be able to. You use schemas, in much the same was as a namespace in C#, to further resolve securable objects within a database when there may be name collisions.