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.
Author |
Topic |
tooba
Posting Yak Master
224 Posts |
Posted - 2012-09-14 : 11:49:36
|
Hi guys, Quick question, how i can use case statment in update statement or i can use or not, below is my codeUpdate MytableSet Book = (Select top 1 'Book' +' '+isnull(e.book, 'No Book') From Table2 Case When isnull(e.book, 'No Book') like %No Book% then '<font Color = Red>' +e.Book + '</font>' else '<font Color=Green>'+ e.book + '</font>')Thank You... |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-09-14 : 16:33:31
|
can you explain what you're trying to do herei cant make out much from codewhich table has column book. whats e?how are tables related?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
tooba
Posting Yak Master
224 Posts |
Posted - 2012-09-15 : 00:52:09
|
Sorry it was typo mistake here is my final QueryUpdate MytableSet Book = (Select top 1 'Book' +' '+isnull(book, 'No Book')From Table2CaseWhen isnull(book, 'No Book') like %No Book% then '<font Color = Red>' +e.Book + '</font>' else'<font Color=Green>'+ book + '</font>')I am updating field Book , IN case Statement i am saying if there is no Book then on front end Color change to Red if there is book Color change to Green. Please let me know if my question is not clear, I want to use this case statement in Update statement.Thank YOu. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-09-15 : 01:38:25
|
why do you need to do formatting in t-sql? it should be done at front end not in t-sqlyou have not yet provided the columns by which tables are related------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|