create a new stored procedure in SQL2012

I want to create a small stored procedure called UpdateOrderDate that runs this bit of code
How do I create it?

  update [TC_Integration].[dbo].[tbl_orderheaders]
  set createddate ='2014-01-06 09:38:08.000'
Chris MichalczukConsultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vikas GargBusiness Intelligence DeveloperCommented:
Hi,

SP.jpg
Clicking on New procedure will open script window

SP2
Hope this would help
0
ste5anSenior DeveloperCommented:
Caveat: This UPDATE will change every row in your table.
0
PortletPaulfreelancerCommented:
WHY would you create a stored procedure to sett ALL records of a table to a constant date/time value????????

Do you intent to have every record in that table "created" at '2014-01-06 09:38:08.000' no matter when you create them?

perhaps use

GETDATE()

instead??
0
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
In addition to the above excellent comments...
--  Note that the database name is NOT in the SP.   
--  That way if this is copied to a different db, it'll still work. 

USE TC_Integration   
GO

CREATE PROC UpdateOrderDate AS

/*
Hey looky here, meaningful code comments!!!

08-08-14   chrismichalczuk   Original.  Serves {some purpose}
*/

update tbl_orderheaders
set createddate ='2014-01-06 09:38:08.000'
GO

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.