vb.net - sql stored procedure -


create proc insert_items(@store varchar(20),@id varchar(20),@name varchar(20),@idate varchar(11)) declare @udates varchar(11), declare @quantity int, declare @defects int select  @quantity  inserted  select  @defects  inserted set @udates = getdate(),       @remanders = @defects - @quantity insert items(storename,productid,productname,quantity,defects,inserteddate,updateddate) values(@store,@id,@name,@quantity,@defects,@idate,@udates) 

the question want value remainder in table l

if table contains remainder field, add insert statement :

    insert items(storename, productid, productname, quantity, defects, inserteddate, updateddate, remainder)  values(@store, @id, @name, @quantity, @defects, @idate, @udates, @remainder) 

a better option might make remainder column in table computed column. way you'll have value, if data wasn't added through stored procedure.


Comments