Click here to Skip to main content
11,634,827 members (65,239 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-server-2005
declare @vc_opportunity_id varchar(100);
set @vc_opportunity_id = '';
declare @in_website_id int;
set @in_website_id = 0;
SELECT a.in_log_id, a.in_website_id, a.vc_opportunity_id, e.Name AS vc_opportunity_name, a.in_client_id, b.in_user_type_id, b.vc_first_name, b.vc_last_name, b.vc_email, d.vc_user_type, c.vc_website_domain_name, a.vc_old_stage_name, a.vc_new_stage_name, a.vc_old_procedure_of_interest__c, a.vc_new_procedure_of_interest__c, a.vc_old_service_of_interest__c,
a.vc_new_service_of_interest__c, CONVERT(VARCHAR(20), a.dt_old_date_of_consultation_c, 101) AS old_consultation_date, CONVERT(VARCHAR(20), a.dt_new_date_of_consultation_c, 101) AS new_consultation_date, a.vc_old_consultation_time_c, a.vc_new_consultation_time_c, CASE WHEN CONVERT(VARCHAR, a.dt_old_appointment_date__c, 101) = '01/01/1900' THEN NULL ELSE CONVERT(VARCHAR, a.dt_old_appointment_date__c, 101) END AS old_appointment_date,
CASE WHEN CONVERT(VARCHAR, a.dt_new_appointment_date__c, 101) = '01/01/1900' THEN NULL ELSE CONVERT(VARCHAR, a.dt_new_appointment_date__c, 101) END AS new_appointment_date, a.vc_old_appointment_window_start__c, a.vc_new_appointment_window_start__c, a.vc_old_appointment_window_end__c, a.vc_new_appointment_window_end__c,
CONVERT(VARCHAR(20), a.dt_log_created, 100) AS log_date FROM dbo.sf_opportunity_client_update_log a
INNER JOIN dbo.website_user b ON a.in_website_id = b.in_website_id AND a.in_user_type_id = b.in_user_type_id
INNER JOIN dbo.website c ON a.in_website_id = c.in_website_id AND c.bt_active = 1
INNER JOIN dbo.common_data_vw_website_user_type d ON a.in_user_type_id = d.in_key
INNER JOIN dbo.sf_opportunity e ON a.vc_opportunity_id = e.Id
WHERE
CASE
WHEN @in_website_id <> 0 THEN a.in_website_id = @in_website_id  ELSE  a.vc_opportunity_id LIKE @vc_opportunity_id + '%'
END = 1

It give Msg 102, Level 15, State 1, Line 15
Incorrect syntax near '='. inside where
Posted 18-Jan-13 22:32pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

WHERE
CASE
WHEN @in_website_id <> 0 THEN a.in_website_id = @in_website_id  ELSE  a.vc_opportunity_id LIKE @vc_opportunity_id + '%'
END = 1
End = 1 is throwing this error. Remove this and try again.
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 8,736
1 Sergey Alexandrovich Kryukov 8,419
2 Mika Wendelius 6,845
3 F-ES Sitecore 2,354
4 Suvendu Shekhar Giri 2,205


Advertise | Privacy | Mobile
Web04 | 2.8.150728.1 | Last Updated 19 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100