Forum Moderators: open

Message Too Old, No Replies

Help with SQL Server 2005 Stored Procedure

         

fscanf

3:19 pm on Aug 10, 2009 (gmt 0)

10+ Year Member



Hi everyone,

I need help creating a stored procedure in SQL Server 2005 running on Win 2k3 Server. I currently have a system in place to sell data to other companies. Some companies that I sell to require a cap on how much data they receive per day.

I currently have a table with all the buyers with the dates and how much data they've purchased. The columns I have are the companies which buy the data, and the rows are the current date. One row for each day (the companies I buy and sell to purchase data every day of the week).

What I need is a stored procedure to check and see if the date row exists, if it doesn't, add the date row and update the company column with '1'. This is the part that I expect to execute just after midnight, for example.

Can anyone point me in the right direction to accomplish this?

Thanks
-fscanf