Format SQL function fails if SQLCMD mode variable is present
eklein@ahd.com
Posts: 17 Bronze 2
The following code
Code is valid and will execute in SQLCMD mode
if the variable is substituted making the code
It will format
SELECT * FROM dbo.sheet_master WHERE RPT_REC_NUM IN ( SELECT RPT_REC_NUM FROM Cost_report_$(HCycleN).dbo.rrn_status WHERE Rec_status = 'dropped' )will not format useing Version 7.1.0.315
Code is valid and will execute in SQLCMD mode
if the variable is substituted making the code
SELECT * FROM dbo.sheet_master WHERE RPT_REC_NUM IN ( SELECT RPT_REC_NUM FROM Cost_report_151231.dbo.rrn_status WHERE Rec_status = 'dropped' )
It will format
Comments
SQL Prompt doesn't currently support partially replacing an identifier with a SQLCMD variable. This is an enhancement we'll consider in the future, for now a workaround is to wrap the identifier with square brackets, ie:
Hope that helps!
Aaron.