.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Aptitude >> Post New QuestionBookmark and Share Subscribe to Forum

Used case in select query

Posted By: Jegan R     Posted Date: November 03, 2010    Points:2   Category :Aptitude
Used case in select query?

Responses
Author: Asha.MP             
Posted Date: November 04, 2010     Points: 5   

Hi..

Wat is your doubt?
do u want know about use of case in select query?

Thanks and Regards,
Asha.mp
Author: rinku rambhiya             
Posted Date: November 08, 2010     Points: 5   

Hi,

According what i understand is that you want something like how case is used in select query in sql.
Basically SQL CASE is used with "when-then-else" functionality (WHEN this condition is met THEN do_this) kind of.

For example, you can use it as follows

USE mydatabase;

SELECT product,
'Status' = CASE
WHEN quantity > 0 THEN 'in'
ELSE 'out'
END
FROM dbo.products;

Hope this helps.

Regards,
Rinkoo



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend