May 31, 2013 at 10:31 am
I want to insert a sign or change the color of particular record based on result of the condition.
for an example if age is more than >45 then all the records in the table which are more than 45 will have some kind of sign or their color shoul get change.
Please help.
thanks.
May 31, 2013 at 10:35 am
You cannot change the "colour" of records in T-SQL. It's up to UI application to format and display results of the query.
May 31, 2013 at 10:37 am
can i put a kind of sign in it.?
May 31, 2013 at 10:39 am
prtk.raval (5/31/2013)
can i put a kind of sign in it.?
Sure.
case when age > 45 then 'here is a sign' else 'no sign here' end as SomeKindOfSign
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
May 31, 2013 at 10:40 am
Yep you can, something like
SELECT ... all you need columns ...
,CASE WHEN [condition] THEN 'Red' ELSE 'Black' END as RowColour
FROM ....
However, I cannot see real need of this, as you better this put this "condition" check in UI
May 31, 2013 at 10:46 am
I am using merge query, i need to indicate that the record is deleted WHEN NOT MATCHED BY THE SOURCE in merge query definition.
i have one column in my detination table that keep the record of status whether its INSERTE, UPDATED, OR DELETED.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply