Hello I'm very intersting for the SQL Script features, but I don't understand how it's work.
The parameters for SQL Connexion is ok but my script return an error
Please find bellow my script.
The error is Syntax error 'x'
****************
DECLARE @ObjectName nvarchar(128)
DECLARE @Sql nvarchar(200)
/*
Suppression des vues
*/
DECLARE x CURSOR FORWARD_ONLY STATIC FOR
SELECT [name] from sys.objects
WHERE [type] IN ('V') AND [name] not like 'sp_%' AND [name] not like 'fn_%' AND [name] not like 'dt_%'
ORDER BY [name]
OPEN x
FETCH NEXT FROM x INTO @ObjectName
WHILE @@FETCH_STATUS = 0
BEGIN
SET @sql = 'DROP VIEW [dbo].' + @objectName
EXEC (@SQL)
FETCH NEXT FROM x INTO @ObjectName
END
CLOSE x
DEALLOCATE x
Could you help me
FOLLOW US
Get the latest news in Application Packaging