4

In T-Sql, a user has a single default schema. Is there a concept of schema search path similar to a postgres search_path?

The question behind the question is, if I use schemas as namespaces for objects, will that mean using qualified names in all code?

0

1 Answer 1

7

No. SQL Server will first check the user's default schema for unqualified object references, and then the dbo schema. If not found at this stage, then you get an error.

I've been searching high and low now, but I can't find a reference for this in the product documentation. And it is even hard to find anybody written about this over the whole interweb. I did, however, find this from Bob.

Max Vernon wrote a post showing how this works here.

Aaron Bertrand has some interesting advice about always specifying the schema, here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.