Respuesta: "Se superó el nivel máximo de anidamiento de vistas......"
Código:
ALTER PROCEDURE [dbo].[usp_Reparar_temporales]
-- Add the parameters for the stored procedure here
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
DECLARE @T varchar(255),@C varchar(255) ,@ss varchar(255), @control integer
set @control=0
--print N'Illegal value : '+@control
DECLARE Table_Cursor CURSOR FOR SELECT a.name,b.name FROM sysobjects a,syscolumns b
WHERE a.id=b.id AND a.xtype='u' AND (a.name like '''temp_%''')
OPEN Table_Cursor
FETCH NEXT FROM Table_Cursor INTO @T,@C
WHILE(@@FETCH_STATUS=0)
BEGIN
set @control=@control+1
EXEC('UPDATE '+@T+' SET '+@C+'=LTRIM(RTRIM(REPLACE('+@C+',''|'' ,'''')))')
-- EXEC('UPDATE temp_Consumo_descrip SET Descripcion=LTRIM(RTRIM(REPLACE(temp_Consumo_descrip.Descripcion,''Local/Tokikoa |'' ,''Lacal'')))')
FETCH NEXT FROM Table_Cursor INTO @T,@C
END
CLOSE Table_Cursor
DEALLOCATE Table_Cursor
END
exec usp_Reparar_temporales
|