Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 stored procedure advice

Author  Topic 

rico_bano
Starting Member

35 Posts

Posted - 2007-08-10 : 09:15:40
Can anyone give me some advice on the best way to do this.

I need to create a stored proc that updates different columns of a table depending on a users action. There will be two actions. save and submit. saving will populate a createddate and createdby field, whereas submitting will populate a submitteddate and submittedby field. Both actions update some common columns.

Im thinking the best way to do this is to create two updates in the stored proc. One that handles the common column updates and then one that updates the non common.

Does this sound like a good plan or should i maybe use some dynamic sql?

thanks

nr
SQLTeam MVY

12543 Posts

Posted - 2007-08-10 : 09:59:26
Wouldn't use dynamic sql unless it saves you a lot of effort and even then you need to be pretty sure about the environment.
Why not just update all columns every time?

You can have an update per column as a catchall and then the common things at the top.
Depends on the interface how easy or flexible it will be.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -