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.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Constant value in a query

Author  Topic 

Vadz
Starting Member

11 Posts

Posted - 2012-12-12 : 20:42:00
hi

i have this value
tom = 100
Ken =50

those to value a my constant value. so when i enter a value greater than both it will return enter another value.i am asking how to do sql query to have a constant value

thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-12-14 : 04:09:00
use CASE WHEN

CASE YourField
WHEN 'tom' THEN 100
WHEN 'Ken' THEN 50
ELSE <other value here>
END AS yourColName

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -