开发者

SQL Select Error When using Case

开发者 https://www.devze.com 2023-03-30 22:32 出处:网络
CASE WHEN PFW_Access__c = 1 THEN \'New开发者_开发问答 Employee (\' + New_Employee_Name__c + \') needs PFW Access\'
CASE WHEN PFW_Access__c = 1
    THEN 'New开发者_开发问答 Employee (' + New_Employee_Name__c + ') needs PFW Access'
    ELSE ''
END AS PFWAccessDesc,`

The line above is just one of many lines in my select statement. It outputs correctly with New Employee (name) needs PFW Access. What I'm trying to do is to add another field to the output Description_Short__c but when I tried to add it to the statement I receive an error. I'm not sure how to add it in to the statement to show in the output.


is this waht you are after?

CASE WHEN PFW_Access__c = 1
    THEN 'New Employee (' + ISNULL(New_Employee_Name__c,'') + ') needs PFW Access '
        +ISNULL(Description_Short__c,'')
    ELSE ''
END AS PFWAccessDesc,


If I remember correctly from a previous question, Description_Short__c is a text field in your database. If you're trying to do just about anything w/ this column, you're going to have to use cast(Description_Short__c as varchar(max)) instead of Description_Short__c.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号