KRayudu V

KRayudu V

  • NA
  • 155
  • 205.6k

how to change null constraint into notnull constraint(Below is my table creation)

Nov 29 2012 7:36 AM
USE [PumaLms]
GO

/****** Object:  Table [dbo].[TicketEntryMasters]    Script Date: 11/29/2012 17:57:37 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[TicketEntryMasters](
    [TicketNumber] [int] IDENTITY(1,1) NOT NULL,
    [DepartmentName] [varchar](50) NULL,
    [IssueCategoryName] [varchar](50) NULL,
    [IssueName] [varchar](50) NULL,
    [Description] [varchar](50) NULL,
    [ContactPerson] [varchar](50) NULL,
    [ContactNumber] [varchar](50) NULL,
    [FileAttachements] [varchar](50) NULL,
    [FileAttachements1] [varchar](50) NOT NULL,
    [FileAttachements2] [varchar](50) NULL,
    [FileAttachements3] [varchar](50) NULL,
    [FileAttachements4] [varchar](50) NULL,
    [TicketID] [int] NULL,
 CONSTRAINT [UQ__TicketEn__CBED06DA0F624AF8] UNIQUE NONCLUSTERED
(
    [TicketNumber] 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

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[TicketEntryMasters]  WITH NOCHECK ADD  CONSTRAINT [n_null_test] CHECK  (([TicketID] IS NOT NULL))
GO

ALTER TABLE [dbo].[TicketEntryMasters] CHECK CONSTRAINT [n_null_test]
GO

ALTER TABLE [dbo].[TicketEntryMasters]  WITH NOCHECK ADD  CONSTRAINT [nn_null_test] CHECK  (([TicketID] IS NULL))
GO

ALTER TABLE [dbo].[TicketEntryMasters] CHECK CONSTRAINT [nn_null_test]
GO



Answers (2)