有没有办法让SQL Server输出固定宽度的字符串?例如
SELECT FixedWidth(cola, 7), FixedWidth(colb, 10) ...
那会分别输出 7 个和 10 个字符宽的 2 个字符串?有点像
'test ' 'foobar '
'aabbb ' 'hello '
'foo ' 'bar '
最佳答案
SELECT
CAST(cola as char(7)) as cola,
CAST(colb as char(10)) as colb ....
https://stackoverflow.com/questions/5173973/