Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003

    Red face Unanswered: Can someone please help with this problem, this is my first time at this forum

    Need Help in getting started on a SP in SQL SERVER2000
    I need help in writing a stored procedure on SQL Server 2000. Basically the stored procedure's primary task is to generate invoice records and insert the records in a invoice table. In order to generate the invoice records, I have an initial table which are basically Day Records. The task that I would like to complete is to select all records from that initial table and I guess put them into a temp table. Now that i have my temp table, I would like to loop thru the table record by record, and do inserts in the invoice table. I cant seem to figure out the syntax since I am somewhat weak in TSQL Programming. I would appreciate any assistance on this forum or to my email. Also If you need some pseudocode for the process or the DDL for the initial table and the invoice table, I can definitely post that in the forum possibly in the next thread. Please advise, I would need a full written syntax to get me started since i have some other processes that I would need to build using the template. Thanks again.

  2. #2
    Join Date
    Jun 2003
    Provided Answers: 1
    Why do you want to loop through the table instead of running a set-based SQL query against the entire dataset? What you are talking about doing is setting up an SQL Cursor which will step through the data one record at a time, but this is an ineffecient method of handling database data, and is only used when there is no other alternative (very rare) or by VB programmers who don't know TSQL (unfortunately very common).
    The task you describe is probably very simple for someone with some knowledge of SQL, but if you are trying to wing-it you are heading into trouble. You need to get some expertise, either in the form of a good SQL Programming turorial or a good SQL consultant.


Posting Permissions

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