Blog Post

A New Use Case for SQL Prompt – Shrinking Code

,

I thought this would work, but I wasn’t sure. I saw some code the other day like this:

DECLARE @char AS CHAR(1); SET @char = NULL; SELECT ISNULL(@char, 0); SELECT COALESCE(@char, 0); SET @char = 'E'; SELECT ISNULL(@char, 0); SELECT COALESCE(@char, 0);

I dropped it into SSMS, and of course, I couldn’t read much of it. I did a quick CTRL+K, CTRL+Y and it looked like this:

DECLARE @char AS CHAR(1); SET @char = NULL; SELECT ISNULL(@char, 0); SELECT COALESCE(@char, 0); SET @char = 'E'; SELECT ISNULL(@char, 0); SELECT COALESCE(@char, 0);

Yeah, SQL Prompt. In addition to reformatting as I prefer, it removed the extra whitespace.

Filed under: Blog Tagged: Red Gate, SQL Prompt, syndicated

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating