Results 1 to 3 of 3

Thread: Moving Source

  1. #1
    Join Date
    Jun 2003
    Location
    Ottawa
    Posts
    105

    Unanswered: Moving Source

    Hi,

    At a high level, this is what I need to do in a stored procedure:

    Code:
    CREATE VIEW TEMP_VIEW AS 
      SELECT * FROM SOURCE_XLS...Sheet1$
    
    -the reason for creating the view is that the number of columns in Sheet1$ is not static. 
    By creating the view, I then can determine with sysobject/syscolumns how many columns I have to process for each row.
    
    DECLARE my_cursor CURSOR  
    FOR SELECT * FROM TEMP_VIEW
    
    OPEN my_cursor
    DECLARE ? ?
    FETCH NEXT FROM my_cursor INTO ??
    WHILE <etc>
       DO STUFF WITH EACH COLUMN IN THAT ROW (as noted above, this will   never be a static list of columns)
    END
    CLOSE my_cursor
    DEALLOCATE my_cursor
    so, Im obviously stuck on what Im going to fetch my_cursor into. Am I limited to scalar types?

    and, inside the WHILE loop, can I refer to the columns by their index (i.e. which column number they are in the result set as opposed to the name)

    or is it back to the drawing board for a completely different approach.

    Thanks for any input.

    Cheers,
    David.
    You're obsessed and distressed 'cuz you can't make any sense
    Of the ludicrous nonsense and incipient senescence
    That will deem your common sense useless

  2. #2
    Join Date
    Jun 2003
    Location
    Ottawa
    Posts
    105

    ignore above.

    came up with a better approach....ignore the above.
    You're obsessed and distressed 'cuz you can't make any sense
    Of the ludicrous nonsense and incipient senescence
    That will deem your common sense useless

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Very good!

    -PatP

Posting Permissions

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