T-SQL How does CHANGETABLE Have a Parameter with the Literal Table Name I can pass the literal table name into the built in function CHANGETABLE. I was wondering how this is done and if it is possible to do in my own stored procedures/inline functions.

In addition to that. If it is possible to pass it to a literal constant first and then pass it to the function so I can get the table ID and not have to specify the table name in two places.

Thanks in advance.
This is just special syntax, nothing more. There should be a hint for you in the fact that you are not passing just the table name but also need to put a keyword, either VERSION or CHANGES, before it. However, even without a keyword it would still be just a syntactic issue.

That is because CHANGETABLES is a built-in Transact-SQL function, part of the language. Of course, one might argue that user-defined functions are, in a way, extensions to the language. Even so, there is pre-defined syntax for such extensions and it does not include all the variety of built-in functions' syntax. For instance, you still cannot put an OVER clause after a UDF, as in window functions, or use AS as a delimiter between arguments, as in the CAST function, or enforce the argument to be a single string literal rather than an expression, as in OPENQUERY or OPENROWSET. In short, built-in functions' syntax cannot serve as an example of what you can do in user-defined functions.

The takeaway of the above is, names still cannot be parameterised in Transact-SQL without resorting to dynamic SQL.