text output, and trailing dashes -----------------------------------

  • how do i remove these from a text output?

    ---------------------------------------------------------

    it's annoying.

    thanks in advance!

    _________________________

  • hi,

       if u cud specify the query used in the job or something more specific,so that we can identify the reason.my guess is that in the output text file these type of dashes might cum coz it mite be explicitly given in the script or something.....

    rgds

    Deepak

    [font="Verdana"]- Deepak[/font]

  • thanks for the response.

    here is what i'm running. with text as output: CTRL+T

    it simply lists all databases and their corresponding size.

    ------------------------------------------------

    set nocount on

    declare @counter smallint

    declare @counter1 smallint

    declare @dbname varchar(100)

    declare @size int

    declare @size1 decimal(15,2)

    set @size1=0.0

    select @counter=max(dbid) from master..sysdatabases

    if exists(select name from sysobjects where name='sizeinfo')

    drop table sizeinfo

    create table sizeinfo(fileid smallint, filesize decimal(15,2), filename varchar(1000))

    while @counter > 0

    begin

    select @dbname=name from master..sysdatabases where dbid=@counter

    truncate table sizeinfo

    exec ('insert into sizeinfo select fileid,size,filename from '+ @dbname +'..sysfiles')

    select @counter1=max(fileid) from sizeinfo

    while @counter1>0

    begin

    select @size=filesize from sizeinfo where fileid=@counter1

    set @size1=@size1+@size

    set @counter1=@counter1-1

    end

    set @counter=@counter-1

    select @dbname as dbname,cast(((@size1)*0.0078125) as decimal(15,2)) as [dbsize(mb)]

    set @size1=0.0

    end

    set nocount off

    ------------------------------------------------

    _________________________

  • Hi, The dashes indicate the size of the column of data that you are working with, and the number of dashes will vary depending on the datatype and size of data that you are returning.

    You specified the variable @dbname as varchar(100).  Because there can be up to 100 characters in each row of that column, the editor has to ensure that it can display all of the data in that column.  The results are displayed as text, so you cannot widen the columns after execution as you can with a grid.

    Essentially, the dashes are spaceholders.  They also differentiate between the header row and the data rows.

    Two ways (at least) of trimming them:

    1. Make sure that the columns you display are appropriately sized.  In this case, if you don't have a database name with anything like 100 characters, don't put the name into a variable that is 100 chars in size.

    2. Using SSMS, go to Query | Query Options and then Results | Text.  There is an option there to change the maximum number of characters returned per column.  Default is 256, but you can change this to as low as 30.  This will reduce the width of the column, but be aware that it does this by truncating the string of returned data.

    3. You can also remove the headings altogether which will remove the dashes, but the columns will retain their original spacing.  Query | Query Options, then Results | Text and deselect "include column headers...".

  • excellent answers!!

    thanks for the break-down too.

    _________________________

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply