sql server - set default schema for a sql query -


is there way set schema query in rest of query can refer tables name without prepending them schema name?

for instance, this:

use [schemaname] select * [tablename] 

as opposed this:

select * [schemaname].[tablename] 

a quick google pointed me this page. explains sql server 2005 onwards can set default schema of user alter user statement. unfortunately, means change permanently, if need switch between schemas, need set every time execute stored procedure or batch of statements. alternatively, use technique described here.

if using sql server 2000 or older this page explains users , schemas equivalent. if don't prepend table name schema\user, sql server first @ tables owned current user , ones owned dbo resolve table name. seems other tables must prepend schema\user.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -