Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
2.2 kB
8
Indexable
Never
Can't Execute this statement:
IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.columns WHERE table_name = 'ArticoliPrezzoAttivo' AND column_name IN ('Magazzino'))
BEGIN
   DROP INDEX [IDX_MagDispArt] ON [dbo].[ArticoliPrezzoAttivo]
   DROP INDEX [IX_ArticoliPrezzoAttivo_Mag] ON [dbo].[ArticoliPrezzoAttivo]
   ALTER TABLE [dbo].[ArticoliPrezzoAttivo] DROP CONSTRAINT [PK_ArticoliPrezzoAttivo]

   ALTER TABLE ArticoliPrezzoAttivo ALTER COLUMN Magazzino  char(3) not null;

   CREATE NONCLUSTERED INDEX [IDX_MagDispArt] ON [dbo].[ArticoliPrezzoAttivo]
   (
	   [Magazzino] ASC,
	   [DispMag] ASC
   )
   INCLUDE([Articolo]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

   CREATE NONCLUSTERED INDEX [IX_ArticoliPrezzoAttivo_Mag] ON [dbo].[ArticoliPrezzoAttivo]
   (
	   [Magazzino] ASC
   )
   INCLUDE([Articolo],[GiacMag],[DispMag],[PreCar],[OrdFor],[QtaV30],[QtaV60]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
   
   ALTER TABLE [dbo].[ArticoliPrezzoAttivo] ADD  CONSTRAINT [PK_ArticoliPrezzoAttivo] PRIMARY KEY CLUSTERED 
   (
	   [Articolo] ASC,
	   [Magazzino] ASC
   )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]

END


Error Number :
	40002
Error Description :
S0012: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot drop the index 'dbo.ArticoliPrezzoAttivo.IX_ArticoliPrezzoAttivo_Mag', because it does not exist or you do not have permission.
RDO Errors        :
S0012: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot drop the index 'dbo.ArticoliPrezzoAttivo.IDX_MagDispArt', because it does not exist or you do not have permission.
S0012: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot drop the index 'dbo.ArticoliPrezzoAttivo.IX_ArticoliPrezzoAttivo_Mag', because it does not exist or you do not have permission.
Leave a Comment