Formating result displayed in query analyzer (sql 2000)

Posted on 2005-04-07
Last Modified: 2011-10-03
Can I format any result of any sql select in query analyzer.

for example
select * from cust

cust_code cust_name limit1 limit2
1             dfadany     25        28  
2             flkjfjd        27         0
3             djakffd       0         27

I want to check if limit1 or limit2 has got zero value.

Can I make limit2 column in row 1 bold or shaded or red coloured.
and            limit1 column in row 2 bold or shaded or red coloured.
Question by:Mateen
    LVL 21

    Accepted Solution

    No....query analyzer does support colore results....better off creating a web page or Access front-end to display the results...
    LVL 23

    Assisted Solution

    As Kevin said, you cannot do this in QA.

    A quick and easy solution would be to highlight the whole grid of results and copy into Excel. Then apply any formatting there.
    LVL 21

    Expert Comment

    You aren't giving your users Query Analyzer access to your databases are you?  If so, please tell me you have their permissions locked down to read only....:-)
    LVL 27

    Assisted Solution

    There is no way for QA to make those changes. There are other products that are like QA, such as ApexSQL Edit. You might investigate them to see if they give you the kind of formatting you want.
    LVL 2

    Assisted Solution

              , cust_name
              , limit1
              , limit2
              , Case
                   When Limit1  = 0 and Limit2 > 0
                          Then 'Limit 1 has zero value'
                    When  Limit1  > 0 and Limit2 = 0
                          Then 'Limit 2 has zero value'
                    When  Limit1  = 0 and Limit2 = 0
                          Then 'Both Colums have zero values'
                     END as ColumnCheck

    From CUST

    As far as Formatting in Query analyzer its pretty limited.  You may be better off using MSQuery and EXCEL.  MSQuery will run your SQL statement against SQL Server ( Or any ODBC database) where you can format your results with value condtions for color properties.   Plus MSQuery will remember your SQL and allow you to refresh on demand.  Its a great tool for reporting especially since it can link directly to the database.

    Typically people Copy and Paste from Query Analyzer.  In my opinion that's lazy.  If you can run a query in Query Analyzer you should be able to run it in MSQUERY.  Eventually Presenting the data in EXCEL. What you rather do?  Open Query analyzer, Run SQL , Copy DATA , Open Excel, PASTE DATA, Re-format, Print or just Open EXCEL, Refresh, print.  Or in other words 7 steps get paid or 3 steps get paid.  Paid by the hour step1 paid by the job step2.  Too much coffee today.

    Hope I help


    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
    The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
    Via a live example, show how to setup several different housekeeping processes for a SQL Server.
    Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now