Competition: What’s your favorite Redgate tool? Enter now.

EXEC SP Comma Placement

sdinglesdingle Posts: 15 New member
edited August 30, 2016 3:34AM in SQL Prompt

I don't know if I am just missing a setting somewhere but on Format > Commas & parentheses I have it set to 'place comma at start'. This option isn't be respected when auto-fill an execute statement for an SP with parameters. My desire is that the parameter have the commas at the start but instead they are at the end. Example below:
EXEC dbo.MySP @param1 = '',
				@param2 = '',
				@param3 = ''

when I would have expected
EXEC dbo.MySP @param1 = ''
				,@param2 = ''
				,@param3 = ''

SQL Prompt Version
SSMS 12.0.2569.0



  • sdinglesdingle Posts: 15 New member
    Well it seems to have fixed itself. I changed one of the EXEC setting Inserted Code > Object & Statement > EXEC Statement > Show Parameter Data Types. I unchecked that option and then the commas were placed as expected. Just as a test I re-checked it and the comma placements was 'ok' but the data type comment was off. I am keeping this option unchecked but you might want to look into it
    EXECUTE dbo.mySP
    	@Param1 = ''
       , -- varchar(50)
    	@Param2 = ''
       , -- varchar(50)
    	@Param3 = '' -- varchar(50)
Sign In or Register to comment.