Stored Procedure for edit form in Sql server 2008 -


i have created stored procedure. return 0 if value less 100 otherwise return 1.it working in case adding new record in case of editing existing record summing previous records , hence everytime value greater 100. sp is:

alter procedure [dbo].[spdescriptionweightislessthanhundred]      -- add parameters stored procedure here     @existingcomponentid int,     @weighttoadd float begin      set nocount on;      declare @existingweightofcomponentguideline float     select @existingweightofcomponentguideline = sum(tcgd.weight)      [templateguidelinedescription] tcgd      tcgd.[templateguidelineid] = @existingcomponentid      declare @totalweight float     set @totalweight = @existingweightofcomponentguideline + @weighttoadd       if @totalweight <= 100         begin             select 0         end          else         begin             select 1          end  end  

please me in code. want values edited. thanks


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -