Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

lu.[TableName] instead of dbo.[TableName]?

Some of the tables in my SQL Server 2005 database is named as lu.[TableName] instead of dbo.[TableName]. What does lu stand for?

Note: I tried google already

like image 928
burnt1ce Avatar asked Nov 30 '22 06:11

burnt1ce


1 Answers

That would be a schema in SQL Server 2005 - which you can create yourself using CREATE SCHEMA.

A schema can be used to separate out database objects that logically belong together, e.g. put all tables related to human resources into a "HR" schema etc. DB Schemas are a bit like .NET or XML namespaces.

A schema can also be used to handle permissions, e.g. you can delegate permissions to user and roles on a schema level.

Have a look at the sample AdventureWorks database which uses schemas extensively.

That's also one of the reasons you should always qualify your database objects with the "dbo." prefix. If you don't, SQL Server's query engine will first have to check your default schema (which could be different from dbo) for the object of that name, and if not found it goes to the dbo schema. If you always use "dbo.YourTableName", the query engine knows upfront where to look - a tiny performance gain (which gets multiplied by thousands of accesses).

like image 174
marc_s Avatar answered Jan 18 '23 01:01

marc_s