We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

teplo
Posts: 8
Joined: Tue Nov 01, 2005 12:15 pm
Location: Geneva

Question with SQL Script features (4.5)

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
teplo
Posts: 8
Joined: Tue Nov 01, 2005 12:15 pm
Location: Geneva

Some comments

The error is not a Sql error syntax.

I have changed the script juste for a SELECT command.

It's important the type of script (unicode, ascII) ?[/img]

Return to “Common Problems”