kannan s

kannan s

  • NA
  • 68
  • 0

I got error in sql stored procedure

Mar 3 2010 6:12 AM
Hi,

I got error in sql Stored Procedure...

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER proc [bigsaas].[sp_shipping_method_update]

@name varchar(50),
@description varchar(max),
@disp_template varchar(50),
@url_tracker_template varchar(50),
@enabled char(10),
@sort int,
@uss varchar(150)
as
declare @valu varchar(150)
--declare @cntt int
begin
--set @valu=
--set @cntt=(exec (@valu))
if exists(' select name from '+ @uss + '_Shipping_Method' + 'where name = @name')
    set @valu = 'update' +@uss+ '_Shipping_Method' + 'set name = @name , description = @description ,
    disp_template = @disp_template , url_tracker_template = @url_tracker_template ,
    enabled = @enabled , sort = @sort where name= @name'
else
    set @valu = 'insert into ' +@uss+'_Shipping_Method' + 'values (@name,@description,@disp_template,@url_tracker_template,@enabled,@sort)'
exec @valu

end


Error message

Msg 102, Level 15, State 1, Procedure sp_shipping_method_update, Line 16
Incorrect syntax near ' select name from '.
Msg 156, Level 15, State 1, Procedure sp_shipping_method_update, Line 20
Incorrect syntax near the keyword 'else'.


Thanks & Regards,

Kannan.S




Answers (6)