sql-case statement
should be used if
multiple
conditions are there
you are using only one case, that you can perform in
if condition
.
if (@FIELD_NAME ='POLICYSTATUS' )
select QS_STATUSCODE AS 'Text' , QS_STATUSCODE AS 'Value' FROM CRM_MST_QUOTESTATUS WITH (NOLOCK)
WHERE QS_TYPE = @FIELD_NAME
else
select QS_STATUS AS 'Text' , QS_STATUSCODE AS 'Value' FROM CRM_MST_QUOTESTATUS WITH (NOLOCK)
WHERE QS_TYPE = @FIELD_NAME
please have a look at this doc
A Simple Use of SQL CASE Expression[
^]