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 SQL code.
+1
A:
You set the default schema based on the user who is logging in via the connection, not the connection itself.
ALTER USER Mary51 WITH DEFAULT_SCHEMA = Purchasing;
Reference:
OMG Ponies
2010-07-19 15:51:06
That would really suck for us though :/
Earlz
2010-07-19 15:53:31
LMAO..I posted exactly the same thing :-)
SQLMenace
2010-07-19 15:53:50
+1
A:
change the default schema associated with that login
example
ALTER USER Mary51 WITH DEFAULT_SCHEMA = Purchasing;
More detail here: http://msdn.microsoft.com/en-us/library/ms176060.aspx
SQLMenace
2010-07-19 15:53:22
+1
A:
No, this is done at the database User level, not in the connection string.
For reference, here are all of the properties which can be set in a connection string: http://www.connectionstrings.com/Articles/Show/all-sql-server-connection-string-keywords
TimS
2010-07-19 15:56:39