Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Formating result displayed in query analyzer (sql 2000)

Posted on 2005-04-07
Medium Priority
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

Kevin3NF earned 800 total points
ID: 13726247
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

adathelad earned 400 total points
ID: 13726270
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

ID: 13726420
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

ptjcb earned 400 total points
ID: 13726428
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.

Assisted Solution

Bearsel earned 400 total points
ID: 13726437
          , 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


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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
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.
Suggested Courses

578 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