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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 stored procedure advice
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

35 Posts

Posted - 08/10/2007 :  09:15:40  Show Profile  Reply with Quote
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?



United Kingdom
12543 Posts

Posted - 08/10/2007 :  09:59:26  Show Profile  Visit nr's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2019 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000