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.
Author |
Topic |
bholmstrom
Yak Posting Veteran
76 Posts |
Posted - 2013-12-31 : 10:06:17
|
Good morning and Happy New Year,I am trying to do an update on a table where one of the update set statment needs to based on the "state' of another field.If the field nc_opp_status already equals 'Approved' then I do NOT want to update the nc_modifydate field, otherwise take the incoming paramenter and update the field nc_modifydate.I am getting the following error:An expression of non-boolean type specified in a context where a condition is expected, near 'ELSE'Here is the statment: SET NOCOUNT ON; UPDATE [NCOS].[dbo].[NCOS_Data] SET [NC_SP_ID] = @nc_sp_id ,[NC_Opportunity_CRMID] = @nc_opportunity_crm_id ,[NC_ModifyDate] = CASE WHEN [NC_Opp_Status} = 'Approved' THEN [NC_ModifyDate] ELSE @nc_modifyDate ENDAny helps is of course always appreciated.ThanksBryan Holmstrom |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-12-31 : 10:23:46
|
The code doesnt have any obvious issues other than a typo ie you've used } instead of ]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
bholmstrom
Yak Posting Veteran
76 Posts |
Posted - 2013-12-31 : 10:30:01
|
Wow that was my bad, thanks and have a great New YearBryan Holmstrom |
|
|
|
|
|