SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

rico_bano
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?

thanks

nr
SQLTeam MVY

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  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000