Tuesday, August 30, 2016

SQL Sample insert sample with declare



Declare @acc1 int
Declare @acc2 int
Select @acc1 = account_id from account where account_number = 'test'
Select @acc2 = account_id from account where account_number = 'test1'



update account_dependency set end_year = 2015
where account_id = @acc1
and dependent_account_id = @acc2
and effective_year = 2012



Insert into account_dependency (account_id, dependent_account_id, curr_year, factor, effective_year, end_year)
values (@acc1, @acc2, 0, 0.800000000, 2016, NULL)

No comments:

Post a Comment