views:

43

answers:

3

In SQL Server 2005/2008, is there some significance to tables that have two leading underscore characters in their name? For example, a tool we use to manage our database creates a table named dbo.__RefactorLog, if it currently doesn't exist. I cannot see this table in SSMS, and Red-Gate SQL Compare doesn't seem to see it either.

Thanks.

+2  A: 

I don't think it's simply the name - I was able to view a table with leading underscores in SSMS (I don't have SQL Compare to check that) on SQL 2008 SP1 X64 Developer.

Are you sure there aren't permissions preventing you from viewing the table? Have you tried logging on as a user with database owner permissions?

Ed Harper
+1  A: 
CREATE TABLE dbo.__foo (_bar int NOT NULL)

I can see this using SQL Compare and SSMS

If you can't see it then it usually means:

  • no permissions
  • wrong db or server
  • wrong schema (eg [CSFB\myUser].__MyTable)
gbn
A: 

If you got look at the tables in tempdb, they have some of the strangest naming conventions I have ever seen with lots and lots of underscores.

I think by naming your tables with initial underscores some tools may decide that they are looking at a temporary table.

I have not tested this theory though, ymmv.

MatthewMartin