buyrun,
IF EXISTS (SELECT * FROM tempdb..sysobjects WHERE id=OBJECT_ID('tempdb..#tmpErrors')) DROP TABLE #tmpErrors GO CREATE TABLE #tmpErrors (Error int) GO SET XACT_ABORT ON GO SET TRANSACTION ISOLATION LEVEL SERIALIZABLE GO BEGIN TRANSACTION GO IF NOT EXISTS (SELECT S1.NAME, S2.NAME FROM SYSCOLUMNS S1, SYSOBJECTS S2 WHERE S1.ID = S2.ID AND S2.type ='U' AND S1.name = 'GRUP' AND S2.name = 'TBLSICIL') BEGIN RAISERROR('KAYITLAR YAPILMIS',16,1) INSERT INTO #tmpErrors (Error) SELECT 1 END GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO TBLOZLUK (ISLETME_KODU, OZLUKKODU, HITAP, ADI, SOYADI, ILKSOYADI, BUNYE_GIRTAR, SSK_NO, SSK_DURUM, EMEK_NO, GRUP, KOD1, KOD2, KOD3, KOD4, KOD5, KOD6, KOD7, KOD8, ORGULKEID, ANABOLGE_KOD, ALTBOLGE_KOD, ORGIL_KOD, BOLUM_KOD, DEPARTMAN_KOD, GOREV_TANIMI, POZISYON_KOD, CINSIYET, MEDENIHAL, COCUK_ADEDI, ESADI, ASKERLIKTIP, TECIL_TERHIS_TAR, MUAFNEDEN, SAKATLIK_DRC, SAKATKATEGORI, SAKATORAN, SAKATACIKLAMA, SAKATEXPIRE, ESKIHUKUMLU, HUKUMACIKLAMA, TERORLEMUCADELE, GOCMEN, BITIRDIGITAHSILI, DEVAMETTIGITAHSILI, KUL_NUMERIC_1, KUL_NUMERIC_2, KUL_NUMERIC_3, KUL_NUMERIC_4, KUL_STRING_1, KUL_STRING_2, KUL_STRING_3, KUL_STRING_4, ISYERI, SICILNO ) (SELECT SIR.ISLETME_KODU, SC.ISYERI+SPACE(8-LEN(SC.ISYERI))+SC.SICILNO, SC.UNVAN, SC.ADI, SC.SOYADI, SC.ILKSOYADI, SC.BUNYE_GIRTAR, SC.SSK_NO, SC.SSK_DURUM, SC.EMEK_NO, SC.GRUP, SC.KOD1, SC.KOD2, SC.KOD3, SC.KOD4, SC.KOD5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, SC.GOREVI, NULL,SC.CINSIYET, SC.MEDENIHAL, SC.COCUK_ADEDI, SC.ESADI, 'M', NULL, NULL,SC.SAKATLIK_DRC, NULL, NULL, NULL, NULL, EK.B_YEDEK1, NULL, EK.I_YEDEK1, SC.GOCMEN, SC.TAHSILI, '-', SC.KUL_NUMERIC_1, SC.KUL_NUMERIC_2, SC.KUL_NUMERIC_3, SC.KUL_NUMERIC_4, SC.KUL_STRING_1, SC.KUL_STRING_2, SC.KUL_STRING_3, SC.KUL_STRING_4, SC.ISYERI, SC.SICILNO FROM TBLSICIL SC LEFT OUTER JOIN TBLSICILEK EK ON EK.SICILNO = SC.SICILNO AND EK.ISYERI=SC.ISYERI INNER JOIN TBLSIRKET SIR ON SC.ISYERI = SIR.ISYERI) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO UPDATE TBLSICIL SET OZLUKID = TBLOZLUK.OZLUKID FROM TBLOZLUK, TBLSICIL WHERE TBLSICIL.ISYERI=RTRIM(SUBSTRING(TBLOZLUK.OZLUKKODU, 1, 8)) AND TBLSICIL.SICILNO=RTRIM(SUBSTRING(TBLOZLUK.OZLUKKODU, 9, 15)) AND TBLSICIL.OZLUKID IS NULL GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO TBLILETISIM (OZLUKID, ISMAIL, SAHSIMAIL, DAHILI1, DAHILI2, ISCEPTEL, SAHSICEPTEL, EVTEL, DIGERTEL, EVADRESI, EVIL, EVILCE, EVSEMT, EVPOSTAKODU, DIGERADRESI, DIGERIL, DIGERILCE, DIGERSEMT, DIGERPOSTAKODU ) SELECT OZ.OZLUKID, SC.EMAIL, NULL, NULL, NULL, NULL, EK.CEPTEL, SC.TEL, NULL, SC.ADRES, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL FROM TBLSICIL SC INNER JOIN TBLOZLUK OZ ON OZ.OZLUKKODU = SC.ISYERI+SPACE(8-LEN(SC.ISYERI))+SC.SICILNO LEFT OUTER JOIN TBLSICILEK EK ON SC.ISYERI = EK.ISYERI AND SC.SICILNO = EK.SICILNO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO TBLKIMLIK (OZLUKID, MERNISNO, UYRUGU, BABAADI, ANAADI, DOG_TARIH, DOG_YERI, DINI, KANGRUBU, NUFUS_IL, NUFUS_ILCE, NUFUS_MAH, NUFUS_KOY, CILT_NO, KUTUK_NO, SAYFA_NO, VERILISTAR, CUZDAN_SERI_NO, CUZDAN_KAYIT_NO, VERILIS_NEDENI, VERGIDAIRE, VERGINO, PASAPORTNO, PASAPORTYER, PASAPORTIL, UYRUKULKEID, PASAPORTTAR, PASAPORTEXPIRE, VERILDIGI_YER) (SELECT TBLOZLUK.OZLUKID, MERNISNO, UYRUGU, BABAADI, ANAADI, DOG_TARIH, DOG_YERI, DINI, KANGRUBU, NUFUS_IL, NUFUS_ILCE, NUFUS_MAH, NUFUS_KOY, CILT_NO, KUTUK_NO, SAYFA_NO, VERILISTAR, SERI_NO, KAYIT_NO, NULL, VERGIDAIRE, VERGINO, NULL, NULL, NULL, NULL, NULL, NULL, NUFUS_DAIRESI FROM TBLSICIL, TBLOZLUK WHERE TBLOZLUK.OZLUKKODU = TBLSICIL.ISYERI+SPACE(8-LEN(TBLSICIL.ISYERI))+TBLSICIL.SICILNO) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO INSERT INTO TBLBANKAHES (OZLUKID, BANKA_1, SUBE_1, HESAP_1, BANKA_2, SUBE_2, HESAP_2, BANKA_3, SUBE_3, HESAP_3, BANKA_4, SUBE_4, HESAP_4, BANKA_5, SUBE_5, HESAP_5, IBAN_1, IBAN_2, IBAN_3, IBAN_4, IBAN_5) (SELECT TBLOZLUK.OZLUKID, BANKA_1, SUBE_1, HESAP_1, BANKA_2, SUBE_2, HESAP_2, BANKA_3, SUBE_3, HESAP_3, BANKA_4, SUBE_4, HESAP_4, BANKA_5, SUBE_5, HESAP_5, IBAN_1, IBAN_2, IBAN_3, IBAN_4, NULL FROM TBLSICIL, TBLOZLUK WHERE TBLOZLUK.OZLUKKODU = TBLSICIL.ISYERI+SPACE(8-LEN(TBLSICIL.ISYERI))+TBLSICIL.SICILNO) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO UPDATE TBLES_COCUK SET OZLUKID = SC.OZLUKID FROM TBLSICIL SC WHERE SC.ISYERI=TBLES_COCUK.ISYERI AND SC.SICILNO=TBLES_COCUK.SICILNO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO UPDATE TBLES_COCUK SET EVLATDURUMU = 'V' WHERE TUR = 1 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO UPDATE TBLES_COCUK SET EVLATDURUMU = 'O' WHERE TUR IN (4, 5, 6, 7, 8, 9, 10, 11, 12, 13) AND EVLATDURUMU IS NULL GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN GRUP GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO DECLARE @cmd VARCHAR(1000) SET @cmd = 'DBO.DROPCONSTRAINT '+'''GOCMEN'''+', '+'''TBLSICIL''' EXEC(@cmd) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN GOCMEN GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO DECLARE @cmd VARCHAR(1000) SET @cmd = 'DBO.DROPCONSTRAINT '+'''TAHSILI'''+', '+'''TBLSICIL''' EXEC(@cmd) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN TAHSILI GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO DECLARE @cmd VARCHAR(1000) SET @cmd = 'DBO.DROPCONSTRAINT '+'''KUL_NUMERIC_1'''+', '+'''TBLSICIL''' EXEC(@cmd) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN KUL_NUMERIC_1 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO DECLARE @cmd VARCHAR(1000) SET @cmd = 'DBO.DROPCONSTRAINT '+'''KUL_NUMERIC_2'''+', '+'''TBLSICIL''' EXEC(@cmd) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN KUL_NUMERIC_2 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO DECLARE @cmd VARCHAR(1000) SET @cmd = 'DBO.DROPCONSTRAINT '+'''KUL_NUMERIC_3'''+', '+'''TBLSICIL''' EXEC(@cmd) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN KUL_NUMERIC_3 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO DECLARE @cmd VARCHAR(1000) SET @cmd = 'DBO.DROPCONSTRAINT '+'''KUL_NUMERIC_4'''+', '+'''TBLSICIL''' EXEC(@cmd) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN KUL_NUMERIC_4 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN KUL_STRING_1 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN KUL_STRING_2 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN KUL_STRING_3 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN KUL_STRING_4 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN EMAIL GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN TEL GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN ADRES GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN MERNISNO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN UYRUGU GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN BABAADI GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN ANAADI GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN DOG_TARIH GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN DOG_YERI GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN DINI GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN KANGRUBU GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN NUFUS_IL GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN NUFUS_ILCE GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN NUFUS_MAH GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN NUFUS_KOY GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN CILT_NO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN KUTUK_NO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN SAYFA_NO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN VERILISTAR GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN SERI_NO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN KAYIT_NO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN VERGIDAIRE GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN VERGINO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN NUFUS_DAIRESI GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN BANKA_1 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN SUBE_1 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN HESAP_1 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN BANKA_2 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN SUBE_2 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN HESAP_2 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN BANKA_3 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN SUBE_3 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN HESAP_3 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN BANKA_4 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN SUBE_4 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN HESAP_4 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN BANKA_5 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN SUBE_5 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN HESAP_5 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN IBAN_1 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN IBAN_2 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN IBAN_3 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN IBAN_4 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN KOD1 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN KOD2 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN KOD3 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN KOD4 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN KOD5 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN UNVAN GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN ADI GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN SOYADI GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN ILKSOYADI GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN BUNYE_GIRTAR GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN SSK_NO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO DECLARE @cmd VARCHAR(1000) SET @cmd = 'DBO.DROPCONSTRAINT '+'''SSK_DURUM'''+', '+'''TBLSICIL''' EXEC(@cmd) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN SSK_DURUM GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN EMEK_NO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN GOREVI GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO DECLARE @cmd VARCHAR(1000) SET @cmd = 'DBO.DROPCONSTRAINT '+'''CINSIYET'''+', '+'''TBLSICIL''' EXEC(@cmd) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN CINSIYET GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO DECLARE @cmd VARCHAR(1000) SET @cmd = 'DBO.DROPCONSTRAINT '+'''MEDENIHAL'''+', '+'''TBLSICIL''' EXEC(@cmd) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN MEDENIHAL GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO DECLARE @cmd VARCHAR(1000) SET @cmd = 'DBO.DROPCONSTRAINT '+'''COCUK_ADEDI'''+', '+'''TBLSICIL''' EXEC(@cmd) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN COCUK_ADEDI GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN ESADI GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO DECLARE @cmd VARCHAR(1000) SET @cmd = 'DBO.DROPCONSTRAINT '+'''SAKATLIK_DRC'''+', '+'''TBLSICIL''' EXEC(@cmd) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICIL DROP COLUMN SAKATLIK_DRC GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICILEK DROP COLUMN B_YEDEK1 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICILEK DROP COLUMN I_YEDEK1 GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLSICILEK DROP COLUMN CEPTEL GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLES_COCUK DROP ESCOCUK_FKEY GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO DROP INDEX TBLES_COCUK_IND_1 ON TBLES_COCUK GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLES_COCUK DROP COLUMN ISYERI GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLES_COCUK DROP COLUMN SICILNO GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLES_COCUK ALTER COLUMN ADI VARCHAR(50) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO ALTER TABLE TBLES_COCUK ALTER COLUMN SADI VARCHAR(50) GO IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION GO IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END GO IF EXISTS (SELECT * FROM #tmpErrors) ROLLBACK TRANSACTION GO IF @@TRANCOUNT>0 BEGIN COMMIT TRANSACTION END GO DROP TABLE #tmpErrors
------------- Netsisden vazgeçemiyorum. Beni engelliyor..
|