Formatting issue
ogrishman
Posts: 81 Bronze 4
I have a piece of code:
It looks like this after formatted using SQL Prompt:
I configured SQL Prompt to align the aliases. However I want to know if there is a way to let aliases have at least one space before them.
Thanks.
SELECT OBJECT_SCHEMA_NAME(c.object_id, DB_ID())schema_name, OBJECT_NAME(c.object_id) object_name, c.name column_name, t.name, t.name + CASE WHEN t.name IN ('char', 'varchar', 'nchar', 'nvarchar') THEN '(' + CASE WHEN c.max_length = -1 THEN 'max' ELSE CONVERT(VARCHAR(4), CASE WHEN t.name IN ('nchar', 'nvarchar') THEN c.max_length / 2 ELSE c.max_length END) END + ')' WHEN t.name IN ('decimal', 'numeric') THEN '(' + CONVERT(VARCHAR(4), c.precision) + ',' + CONVERT(VARCHAR(4), c.scale) + ')' ELSE '' END ddl_name, c.max_length max_length_in_bytes, c.precision, c.scale, c.is_nullable, ISNULL(i.is_primary_key, 0) is_primary_key FROM sys.columns c INNER JOIN sys.types t ON c.user_type_id = t.user_type_id LEFT OUTER JOIN sys.index_columns ic ON ic.object_id = c.object_id AND ic.column_id = c.column_id LEFT OUTER JOIN sys.indexes i ON ic.object_id = i.object_id AND ic.index_id = i.index_id -- WHERE c.object_id = OBJECT_ID('mytable') ORDER BY schema_name, object_name, column_name;
It looks like this after formatted using SQL Prompt:
I configured SQL Prompt to align the aliases. However I want to know if there is a way to let aliases have at least one space before them.
Thanks.
Comments
I think it does make sense to always have a space before the alias, so we've changed this and will be out in the next release.
Best regards,
David