Home Forums SQL Server 2008 T-SQL (SS2K8) Need Help Creating a Loop for Dynamic Stored Procedure RE: Need Help Creating a Loop for Dynamic Stored Procedure

  • You say you want to create records, but your code is updating records.

    Also, I see absolutely no reason to use dynamic SQL here.  Because you are using dynamic SQL, you are forcing an iterative approach, which causes problems.  If you just start out with standard SQL, you can use a set-based approach and won't have an issue when there are multiple records to update.

    Finally, why do you have two separate functions that presumably do the same thing?  Subtracting a number is exactly the same as adding the negative of that same number.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA