tsql - SQL Server Stored Procedure expects parameter, which was not supplied -
create procedure dbo.sp_guild_char_create @i_guild_code varchar(10) , --길드코드 @i_character_name varchar(40) , --캐릭터명 @i_peerage_code varbinary(1) , --작위코드 @o_sp_rtn int output , --실행결과 @2mx_user_no varchar(50) declare @v_max_char_cnt int, --한길드당 최대 길드원 수 @v_row_cnt int begin set nocount on set @o_sp_rtn = -1 set @v_max_char_cnt = 50 --입력값 검증 if @i_guild_code null or @i_character_name null or @i_peerage_code null begin set nocount off set @o_sp_rtn = -1 return end --길드중복가입 검사. if exists( select 1 dbo.guild_char_info with(nolock) character_name = @i_character_name ) begin set nocount off set @o_sp_rtn = -2 return end --한길드당 최대 길드원 수 검증 select @v_row_cnt = count(*) dbo.guild_char_info with(nolock) guild_code = @i_guild_code if @@error <> 0 begin set nocount off set @o_sp_rtn = -3 return end if @v_max_char_cnt <= @v_row_cnt begin set nocount off set @o_sp_rtn = -4 return end --길드원 등록 set @2mx_user_no = (select user_no user_character character_name = @i_character_name) begin tran insert dbo.guild_char_info ( guild_code , character_name , peerage_code , ipt_time , upt_time , user_no ) values( @i_guild_code , @2mx_user_no , @i_character_name , isnull(cast(@i_peerage_code smallint), 9) , getdate() , getdate() ) if @@error <> 0 begin rollback tran set nocount off set @o_sp_rtn = -9 return end commit tran set nocount off set @o_sp_rtn = 0 end go
error in stored procedure:
sql stored procedure expects parameter, not supplied.
i'm getting error , can't understand wrong. please try detailed.
i don't know parameter not supplied , how should fix
your stored procedure expects 5 parameters:
- @i_guild_code varchar(10)
- @i_character_name varchar(40)
- @i_peerage_code varbinary(1)
- @o_sp_rtn int output
- @2mx_user_no varchar(50)
none of them supplied default values procedure. calling code must provide these parameters in sql command.
if calling .net class, should ensure parameters included in sqlcommand. here relevant question:
what's best method pass parameters sqlcommand?
be sure set .direction
property of sqlparameter
if running them directly using sql script, need explicitly include parameters after execution call. see msdn article example.
Comments
Post a Comment