Professional Web Applications Themes

Problems with WHILE and PRINT - Microsoft SQL / MS SQL Server

Jeff, > I am trying to get a WHILE loop to print status messages to Query > yzer as I run the following query on SQL2K SP3: > > Additionally, if I halt execution midway, there is no output. > How can I actually get a message to appear to the screen every 5 > seconds? Use raiserror() with the nowait option and severity 0 for informational message. declare untilTime datetime declare Now varchar(30) SET untilTime = DATEADD(second, 30, getdate()) while getdate() < untilTime begin waitfor delay '00:00:05.000' set Now = convert(varchar(30), getdate(), 121) raiserror ('%s', 0, 1, Now) with ...

  1. #1

    Default Re: Problems with WHILE and PRINT

    Jeff,
    > I am trying to get a WHILE loop to print status messages to Query
    > yzer as I run the following query on SQL2K SP3:
    >
    > Additionally, if I halt execution midway, there is no output.
    > How can I actually get a message to appear to the screen every 5
    > seconds?
    Use raiserror() with the nowait option and severity 0 for
    informational message.

    declare untilTime datetime
    declare Now varchar(30)

    SET untilTime = DATEADD(second, 30, getdate())
    while getdate() < untilTime begin
    waitfor delay '00:00:05.000'
    set Now = convert(varchar(30), getdate(), 121)
    raiserror ('%s', 0, 1, Now) with nowait
    end

    Linda

    lindawie Guest

  2. #2

    Default Re: Problems with WHILE and PRINT


    Thanks. Works just like I need.


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Jeff Albenberg Guest

Similar Threads

  1. Print Problems
    By Anita_Hawkins@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 19
    Last Post: May 18th, 11:38 PM
  2. Print Member Problems
    By TerryFunk webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 0
    Last Post: December 18th, 02:44 PM
  3. Print Problems FH MX MAC OSX
    By Martin Brinker webforumsuser@macromedia.com in forum Macromedia Freehand
    Replies: 1
    Last Post: November 12th, 05:40 PM
  4. Net:Telnet and print() problems
    By Jay Rogers in forum PERL Modules
    Replies: 0
    Last Post: July 16th, 03:18 PM
  5. mail() problems, how do I print out what the error is?
    By James M. Luongo in forum PHP Development
    Replies: 3
    Last Post: July 10th, 08:53 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139