January 26, 2009 at 8:50 am
Hi all,
This is probbaly a really daft question...but I can't find an answer, no matter where I look.
How do you supress the dash line at the end of the query result....
I have a SP with multiple queries in it that I want to send to a file (a report in effect), and I want to drop the extra dash lines between each of the queries (just for appearances sake).
The column headings being underlined is fine, but the dash line at the end of the query is the problem.
How do you get rid of it?
Thanks for any assistance....
Steve.
January 26, 2009 at 7:18 pm
Where are you doing this at? No such dashed line appears in SMS in the Text Mode.
--Jeff Moden
Change is inevitable... Change for the better is not.
January 27, 2009 at 2:59 am
Its part of a scheduled job, that runs overnight and outputs to a text file...which then gets picked up by another package and sent out to remote locations as a report.
Bit like a, how did we do last week....
Thanks for the response.
Steve.
January 27, 2009 at 4:23 am
Steve, can you post the following please -
The statement from the sproc which writes out the text file
A sample of the text file to show exactly what you are describing
Cheers
ChrisM
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
January 27, 2009 at 6:16 am
Steve Berry (1/27/2009)
Its part of a scheduled job, that runs overnight and outputs to a text file...which then gets picked up by another package and sent out to remote locations as a report.Bit like a, how did we do last week....
Thanks for the response.
Steve.
But, that doesn't answer the question... what are you using to create the files that put's the dashed line in where you don't want it?
--Jeff Moden
Change is inevitable... Change for the better is not.
January 27, 2009 at 6:51 am
The output is created by a series of select statements, as sample is shown bellow:
--Output Report Master Header
set @output = 'Weekly Stock Report - Year '+ @yearcode + ' Period '+ @period
select @output
--Output Report sub header
set @output ='Branch ' + @branch + ' ' +(select title from sqs.m_account where account =@branch and ledger ='Branch')
select @output
:NB: Variables are defined else where in the script
which then outputs the following text to a text file as part of a sql scheduled task...
Job 'Weekly Stock Reports' : Step 1, 'Branch 001' : Began Executing 2009-01-27 13:43:42
----------------------------------------------------------------------------------------------------
Weekly Stock Report - Year 2009 Period 01
----------------------------------------------------------------------------------------------------
Branch 023 Warrington Central
----------------------------------------------------------------------------------------------------
All I want to do is drop the ----------- lines.
Thanks for any assistance....
January 27, 2009 at 8:26 am
If what you have above is the only sort of thing you are doing (meaning you are printing off individual statements and not record sets) then you can substitute the
select @output
with
print @output
and you will not get the dashes.
January 27, 2009 at 8:42 am
i tried that it puts a SQLSTATE 0100 on the of each print line...
i'll the the osql route
thanks any way.
January 27, 2009 at 12:10 pm
Best I could come up with does output the lines at the Top of the report but does NOT print lines between the report header and sub header:
set @output = 'Weekly Stock Report - Year '+ @yearcode + ' Period '+ @period + CHAR(10) + CHAR(13) -- line feed and carriage return
--Output Report sub header
set @output =@output + ' Branch ' + @branch
select RTRIM(@output) AS 'Weekly Report'
note I shortened the sub header rather than spend time creating a table and loading it with data.
By the way the number of lines appearing before the header is dependent upon the declared size of your variable @output and if using a Word doc as your printing source the orientation effects the result as well.
January 27, 2009 at 5:58 pm
Steve Berry (1/27/2009)
The output is created by a series of select statements, as sample is shown bellow:--Output Report Master Header
set @output = 'Weekly Stock Report - Year '+ @yearcode + ' Period '+ @period
select @output
--Output Report sub header
set @output ='Branch ' + @branch + ' ' +(select title from sqs.m_account where account =@branch and ledger ='Branch')
select @output
:NB: Variables are defined else where in the script
which then outputs the following text to a text file as part of a sql scheduled task...
Job 'Weekly Stock Reports' : Step 1, 'Branch 001' : Began Executing 2009-01-27 13:43:42
----------------------------------------------------------------------------------------------------
Weekly Stock Report - Year 2009 Period 01
----------------------------------------------------------------------------------------------------
Branch 023 Warrington Central
----------------------------------------------------------------------------------------------------
All I want to do is drop the ----------- lines.
Thanks for any assistance....
But that STILL doesn't tell me what's running the SELECTs! Are you using DTS, SSIS, OSQL, ISQL, SMS, Hammer and Chisel? What? π
--Jeff Moden
Change is inevitable... Change for the better is not.
January 29, 2009 at 10:13 am
Jeff Moden (1/27/2009)
... Hammer and Chisel? What? π
lol - cuneiform?
---------------------------------------------------------
How best to post your question[/url]
How to post performance problems[/url]
Tally Table:What it is and how it replaces a loop[/url]
"stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."
January 29, 2009 at 7:56 pm
jcrawf02 (1/29/2009)
Jeff Moden (1/27/2009)
... Hammer and Chisel? What? πlol - cuneiform?
Heh... :hehe: obviously, a lost language, as well. The OP just refuses to answer a simple question... too bad... there might be a much simpler answer than what the OP has apparently settled for. π
--Jeff Moden
Change is inevitable... Change for the better is not.
February 2, 2009 at 2:51 am
Good morning all....
Hammer and chisell......I ask you......its a nice funny way to sart the week...thanks π
The sql is run by me running a sql 2005 automated job through Sql server management studio.
The job step is a T-SQL type task, which has been told to output the result to a text file.
Some sample sql text was shown ealier in the thread....with the result it gave me.
I am not sure what else you are asking for....
Its a very basic query....I just wanted to know if there was any way to switch off the dash lines that SQL throws out before and after each query result set.
Thanks for your time.
February 2, 2009 at 4:04 am
I don't know much about SSIS... there may be a simpler way to do this, like applying some sort of filter to the output before routing it to the file. But don't know.
Here's a "brute force" method ...
If you turn your SQL Task code into a stored procedure, then you could have your SQL Task call xp_CmdShell and call OSQL to run the proc. In OSQL, you would use the "-h-1" setting to suppress the header, altoghether. Of course, you'd need to modify your T-SQL a bit to provide the headers as the first part of a unioned select with the meat of your query.
Alternative to SQL might be BCP but both of those require a trip through xp_CmdShell.
Like I said, there should be a simpler way in SSIS, but I don't know what it is.
--Jeff Moden
Change is inevitable... Change for the better is not.
February 2, 2009 at 4:08 am
OK cheers.....
I'm already investigating the OSQL route...so I'll add your suggestion to the mix.
Thanks.
Bob Berry:cool:
Viewing 15 posts - 1 through 15 (of 20 total)
You must be logged in to reply to this topic. Login to reply