Formating result displayed in query analyzer (sql 2000)

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.
MateenAsked:
Who is Participating?
 
Kevin HillSr. SQL Server DBACommented:
No....query analyzer does support colore results....better off creating a web page or Access front-end to display the results...
0
 
adatheladCommented:
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.
0
 
Kevin HillSr. SQL Server DBACommented:
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....:-)
0
 
ptjcbCommented:
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.
0
 
BearselCommented:
Select
            cust_code
          , 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'
                Else  
                       Null
                 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

LB
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.