SQLCMD variables

drsqldrsql Posts: 44 Bronze 3
edited October 7, 2009 4:31AM in SQL Refactor Previous Versions
A nice enhancement would be to support the SQLCMD variables that allow you to build scripts like:
:setvar database dbName

select *
from   $(databaseName).dbo.tablename

I build many of my scripts like this in order to support (too many) different databases.



  • Hi

    I have added this to the wish list for inclusion in the discussions when we begin to work on the next version.
    Thanks for the feedback.
    Daniel Handley
    Red Gate Software Ltd
  • The last update to this issue was posted on January 22, 2007. Any news?
  • Hello,

    This feature has not been targeted to any specific release as yet because we have not got enough requests for the feature.
    However, if more user requests flow in you will see it fixed in the near future.

  • weswinklerweswinkler Posts: 54 New member
    Consider this an urgent request for this feature!

    I have begun working on projects generated with the Microsoft Visual Studio Team Edition Database Developer Version (aka DataDude). Many of the scripts must be run in SQLCMD mode in order to utilize project variables, stored in *.sqlcmdvars files.

    When such a query is loaded into the SQL Management Studio and the query session is set to SQLCMD mode, it parses correctly and executes correctly. However, SQL Refactor cannot perform ANY functions, claiming there are errors. The script summarization feature, which I find particularly useful, is completely unavailable in SQLCMD mode.

    See my post in the related forum for SQL Prompt. http://www.red-gate.com/MessageBoard/viewtopic.php?t=9671
  • I would also support this feature being included ASAP

    Senior DBA
    Careers South West Ltd
Sign In or Register to comment.