Use of '$$xxx'

  • I have seen a number of queries that contain statements like "set @SomeBitVariable  = iif('$$SomeName'='1',1,0);" , is there some significance I am missing to the '$$' that I am missing?

  • I think it is one of those "it depends" scenarios.  If the column is named $$SomeName, then yes, the $'s are part of the column name.

    If it is not a column name, then it is a SQLCMD variable (which I learned about how to use those more recently).  I personally don't use SQLCMD inside TSQL as I rarely have a good use case for it.

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply