comportement on error resume next

  • Bonjour,

    j'ai fait une requete qui contient un curseur, lorsque j'execute la requete dans SSMS il y a des erreurs mais il fait la totalité du curseur (genre on error resume next) alors que si je copie ma requete dans un job, celui ci s'arrete dès la premiere erreur.

    J'ai regardé les options du 'Query Execution' mais rien ne semble significatif.

    Comment puis-je avoir le meme comportement dans le job que dans SSMS?

    Merci.

    (SQL SERVER 9.0.4035)

  • il n'y a pas de réponse??

  • I think a response would come quicker if your question was posed in english. Not that we're snobs but english is predominant on this site.

    -- You can't be late until you show up.

  • Google Translator (4/21/2010)


    Hello

    I have an application that contains a cursor when I run the query in SSMS there are mistakes but he made the entire cursor (like on error resume next), so if I copy my application within a job, this one stops when the first error.

    I looked at the options 'Query Execution' but nothing seems significant.

    How do I get the same behavior in the job in SSMS?

    Thank you.

    (SQL SERVER 9.0.4035)

    without seeing the code in the cursor, we cannot help. if it is small, paste it here; if it is large, add it as an attachment.

    Google Translator (4/21/2010)


    sans voir le code dans le curseur, nous ne pouvons pas vous aider. si elle est petite, collez-le ici, si elle est grande, ajoutez-le comme pièce jointe.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • my problem is that the code stops at the first error (The system cannot find the file specified.) when I run it from a job while continuing if I run it in SSMS and what I want is it going even when I run it in a job.

    thx.

    DECLARE @dbname sysname,

    @pathbck varchar(200),

    @bckfile varchar(300),

    @cmd nvarchar (500)

    SET @pathbck = 'F:\MSSQL\Backup\'

    DECLARE cDbname CURSOR READ_ONLY FOR

    SELECT [name]

    FROM sys.databases

    WHERE database_id > 4

    OPEN cDbname

    FETCH cDbname INTO @dbname

    WHILE @@fetch_Status = 0

    BEGIN

    SET @bckfile = @pathbck + @dbname + '_backup.bak'

    EXEC dbo.KillProcess @dbname

    -- EXEC dbo.RestoreDB @dbname, @bckfile

    SET @cmd = N'restore database [' + @dbname +

    N'] from disk = N''' + @bckfile + N''''

    EXEC sp_executesql @cmd

    EXEC dbo.AutoFix @dbname -- sp_change_users_login 'Auto_Fix', 'user'

    FETCH cDbname INTO @dbname

    END

    CLOSE cDbname

    DEALLOCATE cDbname

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply