Kreiranje promjene cijene 12E

Staviti u JOB i to je to!

declare @nesto char (30), @anUserId int, @d1 datetime, @d2 datetime
set @anUserId= (select top 1 anUserId from tPA_User where acUserId = 'AD')
if @anUserId is null
set @anUserId = 2
set @d2 = DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE()))

set @d1 = dateadd(dd, -7, @d2)

declare xPoz cursor local fast_forward for
select acSubject from tHE_SetSubj where acWarehouse = 'T' and acStockRetailValue in ('1','2')
open xPoz

fetch from xPoz into @nesto
while @@fetch_status = 0
begin
exec sd_CreatePrice  @d1, @d2, @nesto, @anUserId
fetch from xPoz into @nesto

end
close xPoz
deallocate xPoz