IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID('CAFE_ADISYON') AND name='Fk_CariId')
	ALTER TABLE CAFE_ADISYON ADD Fk_CariId INT NULL DEFAULT 0;

GO

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID('CAFE_ADISYON') AND name='CariKodu')
	ALTER TABLE CAFE_ADISYON ADD CariKodu nVARCHAR(25) NULL DEFAULT '';

GO

IF NOT EXISTS(SELECT * FROM sys.columns WHERE object_id = OBJECT_ID('CAFE_ADISYON') AND name='Fk_FaturaId')
	ALTER TABLE CAFE_ADISYON ADD Fk_FaturaId INT NULL DEFAULT 0;

GO


UPDATE CAFE_ADISYON SET Fk_CariId = 0  WHERE Fk_CariId IS NULL;
UPDATE CAFE_ADISYON SET CariKodu = ''  WHERE CariKodu IS NULL;
UPDATE CAFE_ADISYON SET Fk_FaturaId = 0  WHERE Fk_FaturaId IS NULL;

GO
