Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Posts
    84

    Unanswered: formatting output

    Hi, I am running a script which inserts certain rows into a table and at the end of the execution, I do a select statement to show the inserted data as output in the results pane and it is showing as truncated...How can I show the full results..
    Here is my script to show the results.
    ----------
    SET NOCOUNT ON
    DECLARE @errorCount INT
    SELECT @errorCount = COUNT(*) FROM error_report WHERE id != - 2 AND id != - 5
    IF @errorCount = 0
    BEGIN
    INSERT INTO error_report VALUES( '' , - 1 , 'No error found.' )
    END
    INSERT INTO error_report VALUES( '' , - 2 , 'The Report was generated on ' + CAST(CONVERT(VARCHAR(23), GETDATE(), 1) AS VARCHAR) )
    GO
    SELECT table_name + ' table has bad data at id = ' + CAST(CONVERT(VARCHAR(23), id) AS VARCHAR) + ' (' + CAST(reason AS VARCHAR) + ')'FROM error_report WHERE id > 0
    SELECT table_name + ' table has bad data (' + CAST(reason AS VARCHAR) + ')' FROM error_report WHERE id = 0
    SELECT reason FROM error_report WHERE id = - 1
    SELECT ''
    SELECT reason FROM error_report WHERE id = - 2
    SET NOCOUNT OFF
    GO
    -------------------------
    The Results in the bottom pane looks like this below
    ------------------
    NODETABLE table has bad data (There are 2 duplicate subclass)
    Propertytable table has bad data (at Parentid = 2000000859 and p)
    Propertytable table has bad data (at Parentid = 10122 and proper)
    -------------------
    But, when I do a select, they are like this below
    ----

    NODETABLE 0 There are 2 duplicate subclass name: Specification
    Propertytable 0 at Parentid = 2000000859 and propertyid = 721
    Propertytable 0 at Parentid = 10122 and propertyid = 9
    Kishore

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    That sounds like a grid limitation to me. I'd suggest Ctrl-T to set text mode, then Ctrl-E to execute the query again.

    -PatP

  3. #3
    Join Date
    Mar 2004
    Posts
    84
    Hi Pat,
    It outputted in the text format but the results are the same. However when I do select statement, it is fine.
    Kishore

  4. #4
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    You need to explicitly specify the size for VARCHAR fields.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  5. #5
    Join Date
    Mar 2004
    Posts
    84
    Hi LOOKING AT THE ABOVE CODE, CAN YOU TELL ME WHERE IT IS?
    Kishore

  6. #6
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    For example, here:

    'The Report was generated on ' + CAST(CONVERT(VARCHAR(23), GETDATE(), 1) AS VARCHAR(8)) )

    But you also don't need that CAST.

    'The Report was generated on ' + CONVERT(VARCHAR(8), GETDATE(), 1)
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •