SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Case statement
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

gov_121
Starting Member

1 Posts

Posted - 05/24/2011 :  15:05:12  Show Profile  Reply with Quote
Can any one please provide me the case statement for the below condition

If IBMCU='034' then plant is "US05" and if IBMCU="201" then plant ="US03" else skip the records

Thanks in advance


Edited by - tkizer on 05/24/2011 15:17:45

TG
Flowing Fount of Yak Knowledge

USA
6062 Posts

Posted - 05/24/2011 :  15:11:10  Show Profile  Reply with Quote

select case
       when forum = 'yak corral' then 'no one answers'
       when forum = 'script library' then 'everyone yells at me'
       when forum = 'new to sql server progarmming' then 'I get my answer'
       else 'who knows'
       end
from   MyTable


Be One with the Optimizer
TG
Go to Top of Page

jcelko
Esteemed SQL Purist

USA
547 Posts

Posted - 05/24/2011 :  21:02:08  Show Profile  Visit jcelko's Homepage  Reply with Quote
There is a CASE expression in SQL; there is no CASE statement. Rows are not records. Please post real DDL. Learn to use ISO-11179 rules for the data element names, avoid needless dialect and use ISO-8601 temporal formats, codes and so forth. People cannot read your mind, so post your code and clear specs if you really want help.

--CELKO--
Books in Celko Series for Morgan-Kaufmann Publishing
Analytics and OLAP in SQL
Data and Databases: Concepts in Practice
Data, Measurements and Standards in SQL
SQL for Smarties
SQL Programming Style
SQL Puzzles and Answers
Thinking in Sets
Trees and Hierarchies in SQL
Go to Top of Page

Lumbago
Norsk Yak Master

Norway
3271 Posts

Posted - 05/25/2011 :  05:28:23  Show Profile  Reply with Quote
Joe: can you please edit your previous post and and set the part that is in your forum-signature in italics? I get REALLY sick of this rows/records/real ddl-crap all the time and I suspect that it's actually a part of your signature. And all this book-spam as well...I would think it's actually working against its purpose with all the shi* you're giving people.

- Lumbago
My blog-> http://thefirstsql.com/2011/02/07/regular-expressions-advanced-string-matching-and-new-split-function-sql-server-2008-r2/
Go to Top of Page

jcelko
Esteemed SQL Purist

USA
547 Posts

Posted - 05/25/2011 :  20:50:51  Show Profile  Visit jcelko's Homepage  Reply with Quote
My signature is my book list. When noobs quit making the same errors in SQL and netiquette over and over, why shouldn't I post the stock replies?

--CELKO--
Books in Celko Series for Morgan-Kaufmann Publishing
Analytics and OLAP in SQL
Data and Databases: Concepts in Practice
Data, Measurements and Standards in SQL
SQL for Smarties
SQL Programming Style
SQL Puzzles and Answers
Thinking in Sets
Trees and Hierarchies in SQL
Go to Top of Page

Lumbago
Norsk Yak Master

Norway
3271 Posts

Posted - 05/26/2011 :  01:23:56  Show Profile  Reply with Quote
quote:
Originally posted by jcelko

My signature is my book list. When noobs quit making the same errors in SQL and netiquette over and over, why shouldn't I post the stock replies?


Because the whole concept of a discussion forum like this is for people to ask questions they don't know the answer to, and for people that actually knoe the answer to tell it to them. Is a 15 year old boy a noob if he asks you where the carborator of a car sits?? He might be a potential world class race car driver but people like you that give him shit for trying to learn isn't really helping him along. You suck Joe, go retire or something.

- Lumbago
My blog-> http://thefirstsql.com/2011/02/07/regular-expressions-advanced-string-matching-and-new-split-function-sql-server-2008-r2/

Edited by - Lumbago on 05/26/2011 01:28:24
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.22 seconds. Powered By: Snitz Forums 2000