if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DocumentiRighe]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
   IF EXISTS (SELECT name FROM sysindexes
         WHERE name = 'IddocumentoP')
   DROP INDEX DocumentiRighe.IddocumentoP
GO
   IF EXISTS (SELECT name FROM sysindexes
         WHERE name = 'IndexUscita')
   DROP INDEX DocumentiRighe.IndexUscita
GO

 CREATE  INDEX [IddocumentoP] ON [dbo].[DocumentiRighe]([IDDocumento]) ON [PRIMARY]
GO

 CREATE  INDEX [IndexUscita] ON [dbo].[DocumentiRighe]([IDUscita]) ON [PRIMARY]
GO

