Reply to Re: Set default schema in code - possible?

Your name:

Reply:


Posted by Erland Sommarskog on 09/27/07 21:46

aj (ronald@mcdonalds.com) writes:
> Is it possible to set the default schema in code?
>
> I know that, for a particular DB user, I can set the default schema
> statically in Mgmt Studio. However, I want to do this dynamically
> in source code.

You can change the default schema for a user with ALTER USER. Look in
Books Online for details. Or use the Script button in SSMS to see how
Mgmt Studio do it.

Whether it is a good idea is another matter. If you are writing an admin
application, I guess it's OK. But if you are considering changing the
schema of the current user on the fly, keep in mind that it will affect
all sessions for that user.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация