Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Column Colors In A Query

Author  Topic 

dwdwone
Yak Posting Veteran

71 Posts

Posted - 2011-12-22 : 14:07:17
I want to set a column in a query (not a report) to red IF a condition exists. Can this be done? If yes, how can I go about it?

Thanks!

Dan

X002548
Not Just a Number

15586 Posts

Posted - 2011-12-22 : 14:14:06
CASE WHEN Cond = TRUE THEN '<red>'+Col+'</red>' ELSE Col END

????

I have no idea what you are talking about

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

dwdwone
Yak Posting Veteran

71 Posts

Posted - 2011-12-23 : 00:20:05
Well, for example, let's take a very simple query like

SELECT OrderID, CustomerID, OrderTime FROM ORDERS

Let's say I wanted all results in the OrderTime column to be displayed with a yellow background. Can this be done?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-23 : 01:15:20
it can be done. But not in query editor. Color,Format etc are presentation related properties and only front end applications/tools will have ability to do it. So depending upon whats your front end tool, you've to add the logic to implement it there.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2011-12-23 : 08:55:18
Well...not to disagree...but my point was that you CAN use T-SQL to generate HTML Formatted code and apply what ever you want and then pass it to the front end

I once created a Rules table that held thos "Properties" for certain conditions and passed that back to the application

I'm all for taking Logic out of the hands of the front end developers

ask for data...display it...request a modification

That's it

in a perfect world



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

dwdwone
Yak Posting Veteran

71 Posts

Posted - 2011-12-25 : 17:17:37
Unfortunately, II don't have a fronr end tool. I wish I did but I'm just an amateur with some SQL experience, and our system does not allow access to the application, just the query editor.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-12-25 : 18:12:49
It is not possible in just a query editor.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-25 : 23:19:06
quote:
Originally posted by dwdwone

Unfortunately, II don't have a fronr end tool. I wish I did but I'm just an amateur with some SQL experience, and our system does not allow access to the application, just the query editor.


Then where are users viewing the data? directly from query editor?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

dwdwone
Yak Posting Veteran

71 Posts

Posted - 2011-12-26 : 09:40:00
The end users normally interact the data througth the application. Customer queries are viewed directly through the query editor.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-26 : 11:24:41
quote:
Originally posted by dwdwone

The end users normally interact the data througth the application. Customer queries are viewed directly through the query editor.


for end users do it in application.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2011-12-26 : 11:33:55
I'm not paid enough

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2011-12-26 : 11:35:31
Dan...when did you start in IT..and what did you do before?

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

dwdwone
Yak Posting Veteran

71 Posts

Posted - 2011-12-26 : 12:25:50
I cut my teeth on the Apple IIe in 1984 and RBase in the late 90s, then wrote several in-house apps through necessity. But I am still just a well practised amatuer. Much to the chagrin of our application provider, who likes to keep things mysterious.
Go to Top of Page
   

- Advertisement -