IF  (EXISTS (SELECT * FROM SYSOBJECTS
              WHERE  SYSOBJECTS.name = 'TDRAMELIYATPAKET' AND xtype='U') )
			  AND  			  
			  (NOT EXISTS (SELECT * FROM SYSCOLUMNS INNER JOIN SYSOBJECTS ON SYSOBJECTS.id = SYSCOLUMNS.id 
              WHERE SYSCOLUMNS.NAME = 'PAKETUCRETI' AND SYSOBJECTS.name = 'TDRAMELIYATPAKET'))
		
DROP TABLE TDRAMELIYATPAKET
			  
GO 

IF NOT EXISTS (SELECT * FROM SYSOBJECTS
              WHERE  SYSOBJECTS.name = 'TDRAMELIYATPAKET')


CREATE TABLE [dbo].[TDRAMELIYATPAKET](
	[DRPAKETID] [int] IDENTITY(1,1) NOT NULL,
	[PAKETADI] [nvarchar](150) NOT NULL,
	[PAKETACIKLAMA] [nvarchar](250) NULL,
	[AKTIF] [bit] NULL,
	[DRID] [int] NULL,
	[ITEMID] [int] NOT NULL,
	[PAKETUCRETI] [float] NULL,
	[DOKTORHAKEDIS] [float] NOT NULL,
	[YARDIMCIDRHAKEDIS] [float] NOT NULL,
	[ANESTEZIDRHAKEDIS] [float] NOT NULL,
	[BASAMAKYUVARLA] [int] NULL,
	[SUBEID] [int] NULL,
	[DOSYADAPAKETHARICISIFIR] [bit] NOT NULL,
 CONSTRAINT [PK_TDRAMELIYATPAKET] PRIMARY KEY CLUSTERED 
(
	[DRPAKETID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO



IF  NOT EXISTS (SELECT * FROM SYSOBJECTS
              WHERE  SYSOBJECTS.name = 'DF_TDRAMELIYATPAKET_AKTIF' AND xtype='D') 

ALTER TABLE [dbo].[TDRAMELIYATPAKET] ADD  CONSTRAINT [DF_TDRAMELIYATPAKET_AKTIF]  DEFAULT ((1)) FOR [AKTIF]
GO
IF  NOT EXISTS (SELECT * FROM SYSOBJECTS
              WHERE  SYSOBJECTS.name = 'DF_TDRAMELIYATPAKET_DRPAKETUCRETI' AND xtype='D') 
ALTER TABLE [dbo].[TDRAMELIYATPAKET] ADD  CONSTRAINT [DF_TDRAMELIYATPAKET_DRPAKETUCRETI]  DEFAULT ((0)) FOR [PAKETUCRETI]
GO
IF  NOT EXISTS (SELECT * FROM SYSOBJECTS
              WHERE  SYSOBJECTS.name = 'DF_TDRAMELIYATPAKET_DRPAKETDRHAKEDISITUTARI' AND xtype='D') 
ALTER TABLE [dbo].[TDRAMELIYATPAKET] ADD  CONSTRAINT [DF_TDRAMELIYATPAKET_DRPAKETDRHAKEDISITUTARI]  DEFAULT ((0)) FOR [DOKTORHAKEDIS]
GO
IF  NOT EXISTS (SELECT * FROM SYSOBJECTS
              WHERE  SYSOBJECTS.name = 'DF_TDRAMELIYATPAKET_YARDIMCIDRHAKEDIS' AND xtype='D') 
ALTER TABLE [dbo].[TDRAMELIYATPAKET] ADD  CONSTRAINT [DF_TDRAMELIYATPAKET_YARDIMCIDRHAKEDIS]  DEFAULT ((0)) FOR [YARDIMCIDRHAKEDIS]
GO
IF  NOT EXISTS (SELECT * FROM SYSOBJECTS
              WHERE  SYSOBJECTS.name = 'DF_TDRAMELIYATPAKET_ANESTEZIDRHAKEDIS' AND xtype='D') 
ALTER TABLE [dbo].[TDRAMELIYATPAKET] ADD  CONSTRAINT [DF_TDRAMELIYATPAKET_ANESTEZIDRHAKEDIS]  DEFAULT ((0)) FOR [ANESTEZIDRHAKEDIS]
GO
IF  NOT EXISTS (SELECT * FROM SYSOBJECTS
              WHERE  SYSOBJECTS.name = 'DF_TDRAMELIYATPAKET_BASAMAKYUVARLA' AND xtype='D') 
ALTER TABLE [dbo].[TDRAMELIYATPAKET] ADD  CONSTRAINT [DF_TDRAMELIYATPAKET_BASAMAKYUVARLA]  DEFAULT ((0)) FOR [BASAMAKYUVARLA]
GO
IF  NOT EXISTS (SELECT * FROM SYSOBJECTS
              WHERE  SYSOBJECTS.name = 'DF_TDRAMELIYATPAKET_DOSYADAPAKETHARICISIFIR' AND xtype='D') 
ALTER TABLE [dbo].[TDRAMELIYATPAKET] ADD  CONSTRAINT [DF_TDRAMELIYATPAKET_DOSYADAPAKETHARICISIFIR]  DEFAULT ((0)) FOR [DOSYADAPAKETHARICISIFIR]
GO


