How about somthing like this .. --First lets create a functin will return the sumup values for you .. --Function Starts here.. Create Function SumCol(@Val int )returns Int As BEgin Declare @Qry Varchar(100),@Cnt Int,@SumVal Int Select @Qry = Cast(@Val as Varchar),@Cnt =0,@SumVal = 0While (@Cnt <=Len(@Qry))Begin Select @SumVal = @SumVal + Cast(SubString(@Qry,@Cnt,1) As Int),@Cnt = @Cnt+1 End Return @SumVal--Now lets create a view Create View VwSumColValuesAs Select Col1,Dbo.SumCol(Col1) As Col2 From TblTmp End
If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.