IF NOT EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
              WHERE SYSOBJECTS.name = 'TMDLEVRAKREFERANSDONEM')
BEGIN
    CREATE TABLE [dbo].[TMDLEVRAKREFERANSDONEM](
        [ID] [int] IDENTITY(1,1) NOT NULL,
        [MDLDONEM] [nvarchar](10) NULL,
        [MDLDONEMEVRAKREFNO] [nvarchar](50) NULL,
        [PASIF] [bit] NULL,
     CONSTRAINT [PK_TMDLEVRAKREFERANSDONEM] PRIMARY KEY CLUSTERED 
    (
        [ID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
    ) ON [PRIMARY]
END
GO

IF NOT EXISTS (SELECT * FROM sys.default_constraints WHERE name = 'DF_TMDLEVRAKREFERANSDONEM_PASIF')
BEGIN
    ALTER TABLE [dbo].[TMDLEVRAKREFERANSDONEM] ADD CONSTRAINT [DF_TMDLEVRAKREFERANSDONEM_PASIF] DEFAULT ((0)) FOR [PASIF]
END
GO

