SQL Server WITH clause -
i getting error when using clause
incorrect syntax near keyword 'with'. if statement common table expression, xmlnamespaces clause or change tracking context clause, previous statement must terminated semicolon.
msg 102, level 15, state 1, procedure viewcomplaintbyprofile, line 29
incorrect syntax near ','.
here procedure
alter procedure [dbo].[viewcomplaintbyprofile] ( @id int ) begin set nocount on 1 (select sno = row_number()over (order complaint_id), complaint_id, complainantname,complainttype_id, complaintprofileid,complainantprofileid,description, email, date_complained, status, admincomments, phone, evidence, plevel = case prioritylevel_id when '1' 'high' when '2' 'medium' when '3' 'low' end , complaint_type = case complainttype_id when '1' 'purchased contact has incorrect details' when '2' 'contacted profile married' when '3' 'suspect profile has fradudelent contect/credentials' when '4' 'suspect profile has fake picture' when '5' 'profile has obscene or inappropriate content' when '6' 'report harassment, offensive remarks, etc., user' when '7' 'miscellaneous issue' end, status1 = case status when 'new' 1 when 'in-progress' 2 when 'closed' 3 end complaints), 2 (select sno = row_number()over (order complaint_id), complaint.complaintprofileid, case when cast(mmbprofiles.mmb_id varchar) not null cast(mmbprofiles.mmb_id varchar) when cast(uppmembership.profile_id varchar) not null 'upp' else 'not found' end mmbid complaints complaint left join mmbmembership on mmbmembership.profile_id = complaint.complaintprofileid left join mmb_businessprofiles mmbprofiles on mmbprofiles.mmb_id = mmbmembership.mmb_id left join uppmembership on uppmembership.profile_id = complaint.complaintprofileid) select one.*,two.mmbid 1 join 2 on one.sno = two.sno (complainttype_id = @id) end
please help
thanks sun
the error message tells do:
.... previous statement must terminated semicolon.
try putting with
statement block of own prepending semicolon:
alter procedure [dbo].[viewcomplaintbyprofile] ( @id int ) begin set nocount on ; 1 ...... .........
Comments
Post a Comment