Results 1 to 5 of 5

Thread: Execute Cursor

  1. #1
    Join Date
    Jan 2009
    Posts
    6

    Unanswered: Execute Cursor

    hi to all,
    how to execute normal cursor in sql server 2005

    anyone can u help me?

    give with example and how to run it dat one

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Cursors (Transact-SQL)
    Lots of examples of how to run dat one
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    It's the same as in 2000...
    Code:
    DECLARE @some_variable int
    
    DECLARE cursor_name CURSOR FOR
      SELECT some_column
      FROM   some_table
      WHERE  some_column < 10
    
    OPEN cursor_name
    
    FETCH NEXT FROM cursor_name INTO @some_variable
    
    WHILE @@Fetch_Status = 0
      BEGIN
        PRINT @some_variable
        FETCH NEXT FROM cursor_name INTO @some_variable
      END
    
    CLOSE cursor_name
    DEALLOCATE cursor_name
    George
    Home | Blog

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Jeez, you are a soft touch these days.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    It was quicker for me to knock that up then find the link


    ...or something
    George
    Home | Blog

Posting Permissions

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