TSQL Naming conventions ~ What's this naming convention called?
Given th开发者_JAVA技巧at I'm using TSQL, what's the name of this style of naming?
\\servername\instance.database.schema.table
and what other items can be inserted in place of .dbo. in the previous naming instance? how does one go about creating those alternatives? links to answers welcome
Also, how would one refer to a job on the server instead of a table or a sproc?
My intention is for when I write up my work for documentation (say when I'm closing out my FogBugz ticket or something) then I want to be able to at least sound like I know what I'm doing ;)
(updated per links and comments)
Three & four part name are the most common references I've come across, but as you can see - there's lots of shorthand alternatives.
The dbo
is the schema. You can create new schemas and assign db objects to the schema.
That is the entire path. If you're hitting a table within your default schema (this is dbo by default) all you need is table. (SELECT * FROM Addresses)
If you're hitting a table on a schema other than the user's default (or you want to protect yourself from future changes) then you'll put Schema.Table. (SELECT * FROM Customers.Addresses)
If you're looking to hit a table on a different database within the same server, you will need to put DatabaseName.Schema.Table. (SELECT * FROM ProductionDB.Customers.Addresses)
Finally, if you're looking to a hit a table on a different server all-together, you need the full path. These machines must also have a server-link, AFAIK.
精彩评论