patternsqlModerate
What is the significance of the trailing dollar sign `$` on identifiers in SQL Server?
Viewed 0 times
significancethewhatserversqldollaridentifierstrailingsign
Problem
Dumping some internal views, such as
And, this works too
Even if only by convention, what is the rule here regarding this? Should I be using this in my own code?
Searching I see a lot of stuff about Excel (which is unrelated), and Money literals (which is also unrelated).
I posted another question which I thought was unrelated, but I believe this terminal
sys.system_objects as done in this question I see that some identifiers end with a dollar-sign $CREATE VIEW sys.system_objects AS
-- cutout
FROM sys.sysschobjs$ o -- XXX: HERE
LEFT JOIN sys.syspalnames n
-- not relevantAnd, this works too
SELECT * FROM sys.sysschobjs$;Even if only by convention, what is the rule here regarding this? Should I be using this in my own code?
Searching I see a lot of stuff about Excel (which is unrelated), and Money literals (which is also unrelated).
I posted another question which I thought was unrelated, but I believe this terminal
$ will shed a lot more light on it. Feel free to check that question for an example of some confusionSolution
Even if only by convention, what is the rule here regarding this?
There is nothing stopping you from using a
Should I be using this in my own code?
See above.
Dumping some internal views [...]
There are various other items you'll see such as OPENROWSET or OPENTABLE. I'll save you from another question, no there isn't a way to see that definition.
You can think of Dynamic Management Views (DMVs) as taking a memory structure and making it a rowset... and literally that's what is being done. There is a difference between an internal base table (which holds metadata about the database objects) and DMVs (which are in memory structures).
DMVs will be helpful to you, internal base tables will not be very helpful as you won't find much (if any) documentation on the table itself or the values inside of it.
Can you describe the convention amongst $, a % or %%, # or ## that is used internally?
No, I would also not worry about it as it makes no actual difference to you.
When you say "no there isn't a way to see that definition" you mean the definition for sys.sysschobjs$
Depends, do you see
What would you call
I would call it an internal base metadata table. You could call it whatever you like, just how "automobile" is also called a "car".
You described DMVs (which I believe I understand), and Base Tables which I also believe I understand, but not internal items that end in $ or how they relate DMVs and Base Tables.
Some will end in $ some won't, some will have #, some won't. Like I said above, you'll find a variety of items used. There isn't a hard and fast rule. Example being you see that table end in
I believe you're reading into this waaaaaaaaay too much. There is no secret code or handshake or society.
There is nothing stopping you from using a
$ in your code... generally, though, using reserved values is frowned upon. Most internal items you'll see will use a $, a % or %%, # or ##. I'd stay away from using all of those in my user code.Should I be using this in my own code?
See above.
Dumping some internal views [...]
There are various other items you'll see such as OPENROWSET or OPENTABLE. I'll save you from another question, no there isn't a way to see that definition.
You can think of Dynamic Management Views (DMVs) as taking a memory structure and making it a rowset... and literally that's what is being done. There is a difference between an internal base table (which holds metadata about the database objects) and DMVs (which are in memory structures).
DMVs will be helpful to you, internal base tables will not be very helpful as you won't find much (if any) documentation on the table itself or the values inside of it.
Can you describe the convention amongst $, a % or %%, # or ## that is used internally?
No, I would also not worry about it as it makes no actual difference to you.
When you say "no there isn't a way to see that definition" you mean the definition for sys.sysschobjs$
Depends, do you see
OPENTABLE or OPENROWSET in that definition as I stated above? If not, then you can probably see the base tables over a DAC or DAC + Single User Mode connection.What would you call
sysschobjs$ you say "internal item" is that the most specific name in the Microsoft parlance?I would call it an internal base metadata table. You could call it whatever you like, just how "automobile" is also called a "car".
You described DMVs (which I believe I understand), and Base Tables which I also believe I understand, but not internal items that end in $ or how they relate DMVs and Base Tables.
Some will end in $ some won't, some will have #, some won't. Like I said above, you'll find a variety of items used. There isn't a hard and fast rule. Example being you see that table end in
$ but there are functions that also use $. Again, at the end of the day it's a name and nothing else.I believe you're reading into this waaaaaaaaay too much. There is no secret code or handshake or society.
Context
StackExchange Database Administrators Q#193574, answer score: 10
Revisions (0)
No revisions yet.