ALTER TABLE [Seg_Menu_Mod] DROP CONSTRAINT [PK_SMM] 
GO

UPDATE [Seg_Menu_Mod] SET [Id_Menu_Padre] = 0 WHERE [Id_Menu_Padre] IS NULL
GO

ALTER TABLE [Seg_Menu_Mod] ADD CONSTRAINT   [PK_SMM] PRIMARY KEY CLUSTERED (Item)
GO

DROP INDEX [IX_SMM_Men] ON [dbo].[Seg_Menu_Mod]
GO

CREATE  NONCLUSTERED INDEX [IX_SMM_Men] ON [dbo].[Seg_Menu_Mod]
(
	[Id_Menu] ASC,
	[Id_Modulo] ASC
)
GO

DROP INDEX [IX_SMM_Mod_Ord_Padre_Men] ON [dbo].[Seg_Menu_Mod]
GO


ALTER TABLE Seg_Menu_Mod ALTER COLUMN Orden INT
GO

CREATE NONCLUSTERED INDEX [IX_SMM_Mod_Ord_Padre_Men] ON [dbo].[Seg_Menu_Mod]
(
	[Id_Modulo] ASC,
	[Orden] ASC,
	[Id_Menu_Padre] ASC,
	[Id_Menu] ASC
)
GO

