﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / T-SQL (SS2K5)  / CASE WHEN Statement when creating a VIEW / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sat, 25 May 2013 16:30:34 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: CASE WHEN Statement when creating a VIEW</title><link>http://www.sqlservercentral.com/Forums/Topic1391820-338-1.aspx</link><description>[quote][b]anthony.green (12/3/2012)[/b][hr]It hits the first true condition then terminates the case statement.[/quote]Thank you - I did feel this was the case but the data does not reflect the logic!?Will now dig deeper.Thank you</description><pubDate>Mon, 03 Dec 2012 03:43:14 GMT</pubDate><dc:creator>SteveEClarke</dc:creator></item><item><title>RE: CASE WHEN Statement when creating a VIEW</title><link>http://www.sqlservercentral.com/Forums/Topic1391820-338-1.aspx</link><description>It hits the first true condition then terminates the case statement.</description><pubDate>Mon, 03 Dec 2012 03:41:09 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>RE: CASE WHEN Statement when creating a VIEW</title><link>http://www.sqlservercentral.com/Forums/Topic1391820-338-1.aspx</link><description>[quote][b]Eugene Elutin (12/3/2012)[/b][hr][quote]... does it do one condition and then drop to the CASE...END statement after satisfying one of the conditions?  [/quote]That is correct.[/quote]Sorry;My question is; Do I understand the CASE logic correctly and does it do one condition and then drop to the CASE...END statement after satisfying one of the conditions? OR Does it do EVERY CASE WHEN check and hold the last one as the description ?So if I put an initial check in saying ... CASE StockCode like 'Stock%' Then 'Yippee'ALL Records would fall into this and no other categories would be highlighted.</description><pubDate>Mon, 03 Dec 2012 03:39:24 GMT</pubDate><dc:creator>SteveEClarke</dc:creator></item><item><title>RE: CASE WHEN Statement when creating a VIEW</title><link>http://www.sqlservercentral.com/Forums/Topic1391820-338-1.aspx</link><description>[quote]... does it do one condition and then drop to the CASE...END statement after satisfying one of the conditions?  [/quote]That is correct.</description><pubDate>Mon, 03 Dec 2012 03:35:52 GMT</pubDate><dc:creator>Eugene Elutin</dc:creator></item><item><title>CASE WHEN Statement when creating a VIEW</title><link>http://www.sqlservercentral.com/Forums/Topic1391820-338-1.aspx</link><description>Hi Guys,I am having a few issues with some code and wanted some guidance ;I am creating a view based on a table, and need to create a "Identify" column, based on the data in the table ;Simple - 3 columnsStockCode, MorB, WarehouseStockA,M,AAStockB,B,AAStockC,B,BBStockD,B,CCStockE,M,BBMy Logic;SelectStockCode, MoRB, ,Warehouse,CASE   WHEN Warehouse = 'CC' then 'Cars'   WHEN MorB          = 'B'   then 'Bought'   WHEN Warehouse = 'AA' then 'Available'   ELSE 'xxx'ENDas StockCategoryReseult:I would hope to see the following;StockD,B,CC,'Cars'StockB,B,AA,'Bought'StockA,M,AA,'Available'StockC,B,BB,'xxx'StockE,M,BB,'xxx'My question is;  Do I understand the CASE logic correctly and does it do one condition and then drop to the CASE...END statement after satisfying one of the conditions?  or does it do EVERY CASE WHEN check and hold the last one as the description ?</description><pubDate>Mon, 03 Dec 2012 02:55:20 GMT</pubDate><dc:creator>SteveEClarke</dc:creator></item></channel></rss>