Statement mana yang menghapus recordmu ?

200 record dalam tabel CustInvoiceJour hilang karena statement query saya ? Statement yang mana ? Ini saya copy-paste kan query yang minggu kemarin saya execute. Tujuan saya melakukan query adalah untuk mengupdate field FakturPajakID dengan menambahkan karakter ‘A’ di belakang penomoran faktur pajak selama bulan Januari sampai Maret 2007. Tidak ada tujuan untuk menghapus record.

Dalam Axapta, tabel CustInvoiceJour, menyimpan semua invoice customer yang sudah digenerate no invoicenya menjadi nomor faktur pajak yang disesuaikan dari kantor Pajak. Di bawah ini querynya, coba diperhatikan ya :

use AxDB_KTN

select ItemGroupId,ItemId,Dimension3_
from InventTable
where DataAReaID = ‘ktn’ order by ItemGroupId

update InventTable
set Dimension3_ = ‘PRIN’
where DataAReaId = ‘ktn’ and rtrim(ltrim(ItemGroupId)) = ‘FG’

select InvoiceDate,PGI_TCT_FakturPajakId
from CustInvoiceJour
where DataAReaId = ‘ktn’ and Month(InvoiceDate) between ‘1’ and ‘3’
and Year(InvoiceDate)= ‘2007’
order by PGI_TCT_FakturPajakId


declare @var_PGI_TCT_FakturPajakId varchar(20)

select @var_PGI_TCT_FakturPajakId = PGI_tct_FakturPajakId
from CustInvoiceJour where DataAReaId = ‘ktn’ and Month(InvoiceDate) between ‘1’ and ‘3’
order by PGI_TCT_FakturPajakId

select @var_PGI_TCT_FakturPajakId+’A’


declare @var_PGI_TCT_FakturPajakId varchar(20)
set @var_PGI_TCT_FakturPajakId = 1

update CustInvoiceJour
set PGI_TCT_FakturPajakId = @var_PGI_TCT_FakturPajakId
(select @var_PGI_TCT_FakturPajakId = PGI_TCT_FakturPajakId
from CustInvoiceJour where DataAReaId = ‘kn’)
(select @var_PGI_TCT_FakturPajakId+’A’)
–select @Counter = COUNT(*) from CustInvoiceJOur where DataAReaId = ‘kn’
–print @Counter


declare @var_PGI_TCT_FakturPajakId varchar(20)
while
 begin
    select @var_PGI_TCT_FakturPajakId = PGI_TCT_FakturPajakId from CustInvoiceJour
    print @var_PGI_TCT_FakturPajakId
end

select PGI_Tct_FakturPajakId
from CustInvoiceJour
where DataAreaId = ‘kn’

use AxDB_KTN

select InvoiceId,InvoiceDate,PGI_Tct_FakturPajakId
from CustInvoiceJour
where DataAreaId = ‘ktn’
order by PGI_TCT_FakturPajakId

select InvoiceDate,InvoiceId,PGI_TCT_FakturPajakId
from CustInvoiceJour
where DataAReaId = ‘ktn’ and Month(InvoiceDate) between ‘1’ and ‘3’
and Year(InvoiceDate)= ‘2007’
order by PGI_TCT_FakturPajakId

select *
from CustinvoiceJour
where rtrim(ltrim(InvoiceId)) = ‘FI07-0127’

use Ax_KTN_1
select InvoiceId,PGI_TCT_FakturPajakId
from CustInvoiceJour where rtrim(ltrim(InvoiceId)) = ‘FI07-0127’
order by PGI_TCT_FakturPajakId

— 26 April 07
update CustInvoiceJOur
set PGI_Tct_FakturPajakId = CustInvoiceJour.PGI_Tct_FakturPajakId+’A’
where DataAreaId = ‘kn’ and Month(InvoiceDate) = ‘1’ and Year(InvoiceDate)= ‘2007’

select InvoiceId,InvoiceDate,PGI_Tct_FakturPajakId,dataareaId
from CustInvoiceJour
where DataAreaId = ‘ktn’ and month(invoiceDate)=’1′ and Year(InvoiceDate)= ‘2007’
and left(ltrim(pgi_tct_fakturpajakid),4) = ‘010.’
order by InvoiceDate

update CustInvoiceJOur
set PGI_Tct_FakturPajakId = CustInvoiceJour.PGI_Tct_FakturPajakId+’A’
where DataAreaId = ‘kn’ and month(invoiceDate)=’1′ and Year(InvoiceDate)= ‘2007’
and left(ltrim(pgi_tct_fakturpajakid),4) like ‘010.’
order by InvoiceDate

select *
from CustInvoiceTrans
where DataAReaId = ‘ktn’ and month(invoiceDate)=’4′ and Year(InvoiceDate)= ‘2007’

use axdb_ktn_3
select * from CustInvoiceTrans
where DAtaAreaId = ‘ktn’ and month(InvoiceDate)=’3′ and Year(InvoiceDate)= ‘2007’

Cukup jelas bukan ?
Tidak ada statement yang meninstruksikan untuk menghapus record.

( Artikel pembelaan diri )

Powered by ScribeFire.


About this entry