Click here to Skip to main content
15,912,082 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
SQL
CREATE PROCEDURE sp_ResourceInsUpdDel (
	@ResourceId int,
	@Resource_Name varchar(50),
	@Choice int)
AS
BEGIN
	if(@Choice = 0)
insert into ResourceDetails values(@Resource_Name)
else if(@Choice =1)
update ResourceDetails set Resource_Name=@Resource_Name where ResourceId=@ResourceId
else if(@Choice =2)
delete from ResourceDetails where ResourceId=@ResourceId
End


i am getting error
XML
Msg 213, Level 16, State 1, Procedure sp_ResourceInsUpdDel, Line 9
Insert Error: Column name or number of supplied values does not match table definition

please help me
Posted
Updated 22-Aug-12 19:10pm
v2

1 solution

try below code...
your insert statement was incorrect..
SQL
CREATE PROCEDURE sp_ResourceInsUpdDel (
	@ResourceId int,
	@Resource_Name varchar(50),
	@Choice int)
AS
BEGIN
	if(@Choice = 0)
insert into ResourceDetails(Resource_Name) values(@Resource_Name)
else if(@Choice =1)
update ResourceDetails set Resource_Name=@Resource_Name where ResourceId=@ResourceId
else if(@Choice =2)
delete from ResourceDetails where ResourceId=@ResourceId
End
 
Share this answer
 
Comments
Lakshmimsridhar 23-Aug-12 1:22am    
thank u its working
ssd_coolguy 23-Aug-12 1:26am    
i am glad it's working..
accept the answer..

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900