Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you set default Schema for SQL 2008 Query

I have a schema called application. Is there a way that, rather than using the syntax

SELECT * FROM application.table

I can set the default schema so that I can just use

SELECT * FROM table

It would be the same idea as a using statement I suppose.

like image 381
Fermin Avatar asked Dec 18 '22 06:12

Fermin


2 Answers

The default schema for all sql server users is "dbo", You can alter the default schema for a user by using commands ALTER USER

ALTER USER UserName WITH DEFAULT_SCHEMA = application;
like image 79
Wael Dalloul Avatar answered Jan 18 '23 05:01

Wael Dalloul


It will be great to have a use statement for schemas. You can vote the feature suggestion on Microsoft connect.

like image 42
HuBeZa Avatar answered Jan 18 '23 04:01

HuBeZa