February 12, 2009 at 3:00 am
Hi,
I hope anyone can help me with this annoying problem.
Some queries I have scheduled in job have a text file as output file. All works, but often the columnheaders of the result are underlined with "-" which is far to wide. Example 'servername' as header, but 128 x "-" as underline.
Can I change this so it gets trimmed ?
thx2all
February 13, 2009 at 10:42 am
You are getting 128 dashes because that column has been declared as having a lenght of 128.
I can only suggest using [font="Courier New"]SUBSTRING(long_column, 1, 30) AS long_column[/font].
I cannot test it in the Query Analyzer because, way back when, I had set an option to not output the dash line between the column names and the first line of results in the results pane. I just do not remember how I did it.
February 13, 2009 at 11:30 am
Hey J, thanks for the reply anyway. If you can disable the dashes, I can do some more searches on this.
Grtz,
T.
February 13, 2009 at 11:36 am
Mind you, I was talking about the Query Analyzer only.
"Are you Sarah Connor?"
February 13, 2009 at 11:39 am
owkee.
I need you clothes and motorcycle... 😀
February 14, 2009 at 10:00 am
T2000 (2/13/2009)
Hey J, thanks for the reply anyway. If you can disable the dashes, I can do some more searches on this.Grtz,
T.
Cast the output as VARCHAR(DesiredColumnWidthHere).
--Jeff Moden
Change is inevitable... Change for the better is not.
February 14, 2009 at 11:53 am
thank you for your input Jeff! Will try this.
rgds,
T.
February 14, 2009 at 12:30 pm
You bet... thanks for the feedback. Let us know how it works out for you.
--Jeff Moden
Change is inevitable... Change for the better is not.
February 16, 2009 at 8:02 am
Cast the output as CONVERT(VARCHAR(DesiredColumnWidthHere), long_column_name) AS long_column_name.
Interesting.
So I suppose this is more efficient than SUBSTRING ?
Regards
February 16, 2009 at 10:45 am
J (2/16/2009)
Cast the output as CONVERT(VARCHAR(DesiredColumnWidthHere), long_column_name) AS long_column_name.Interesting.
So I suppose this is more efficient than SUBSTRING ?
Regards
Sorry to use the ol' cliche`, but it depends... sometimes SUBSTRING won't change the length of the output column. Casting the final result of the column always does.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply