SSMS Datagrid formating issues

  • Im trying to format a query involving several fields and separated by the | symbol. Im casting the text for these fields as fixed width so I can easily use this in a vb.net listbox control im using, however the formatting seems to behave in a haphazard way when I view from the grid view of SSMS or via the listbox control. However when i view the results in text format from SSMS ( or from 2000 Query Analyzer) the results look ok.

    Heres a query ive used to illustrate the problem (based on the AdventureWorks database)

    SELECT

    cast(LoginID as char(28)) + ' | ' +

    cast(Title as char(40)) + ' | ' +

    CONVERT(CHAR(11), BirthDate, 106 )

    FROM HumanResources.Employee

    Heres what it looks like in grid view and vb.net

    adventure-works\guy1 | Production Technician - WC60 | 15 May 1972

    adventure-works\kevin0 | Marketing Assistant | 03 Jun 1977

    adventure-works\roberto0 | Engineering Manager | 13 Dec 1964

    adventure-works\rob0 | Senior Tool Designer | 23 Jan 1965

    adventure-works\thierry0 | Tool Designer | 29 Aug 1949

    heres what it looks in text view:

    It appears in the correct way, ie all the columns are formatted with equal distances between the | symbol.

    Has anyone encountered this or knows a workaround?

  • I think you have to use Temp table or cursor

Viewing 2 posts - 1 through 1 (of 1 total)

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