BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
GO
ALTER TABLE dbo.TSENCARDDOSYATUR
	DROP CONSTRAINT DF_TSENCARDDOSYATUR_AKTIF
GO
CREATE TABLE dbo.Tmp_TSENCARDDOSYATUR
	(
	ID int NOT NULL IDENTITY (1, 1),
	DocTypeId int NOT NULL,
	DocTypeDesc nvarchar(100) NULL,
	FR3_AYAKTAN nvarchar(250) NULL,
	FR3_YATARAK nvarchar(250) NULL,
	FR3_GUNUBIRLIK nvarchar(250) NULL,
	AKTIF bit NOT NULL,
	SUBEID int NULL
	)  ON [PRIMARY]
GO
ALTER TABLE dbo.Tmp_TSENCARDDOSYATUR SET (LOCK_ESCALATION = TABLE)
GO
ALTER TABLE dbo.Tmp_TSENCARDDOSYATUR ADD CONSTRAINT
	DF_TSENCARDDOSYATUR_AKTIF DEFAULT ((1)) FOR AKTIF
GO
SET IDENTITY_INSERT dbo.Tmp_TSENCARDDOSYATUR OFF
GO
IF EXISTS(SELECT * FROM dbo.TSENCARDDOSYATUR)
	 EXEC('INSERT INTO dbo.Tmp_TSENCARDDOSYATUR (DocTypeId, DocTypeDesc, FR3_AYAKTAN, FR3_YATARAK, FR3_GUNUBIRLIK, AKTIF, SUBEID)
		SELECT DocTypeId, DocTypeDesc, FR3_AYAKTAN, FR3_YATARAK, FR3_GUNUBIRLIK, AKTIF, SUBEID FROM dbo.TSENCARDDOSYATUR WITH (HOLDLOCK TABLOCKX)')
GO
DROP TABLE dbo.TSENCARDDOSYATUR
GO
EXECUTE sp_rename N'dbo.Tmp_TSENCARDDOSYATUR', N'TSENCARDDOSYATUR', 'OBJECT' 
GO
ALTER TABLE dbo.TSENCARDDOSYATUR ADD CONSTRAINT
	PK_TSENCARDDOSYATUR_1 PRIMARY KEY CLUSTERED 
	(
	ID
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
COMMIT
select Has_Perms_By_Name(N'dbo.TSENCARDDOSYATUR', 'Object', 'ALTER') as ALT_Per, Has_Perms_By_Name(N'dbo.TSENCARDDOSYATUR', 'Object', 'VIEW DEFINITION') as View_def_Per, Has_Perms_By_Name(N'dbo.TSENCARDDOSYATUR', 'Object', 'CONTROL') as Contr_Per 