Timestamp when inserting records into a table

I have a query that inserts records into a table (FRA) and now want to add the time that is inserted into the FRA table to the record.  Any ideas?

This is what I tried, but it doesn't work:


INSERT INTO FRA

declare @cur_date as datetime
set @cur_date = getdate()

select      @cur_date as 'DATEPOSTED',cubeproj.PROJ_NAME as 'PROJECTNAME',CPN.PROJ_OUTLINECODE_NAME as 'CAPITALPROJECT#',projent.ProjectEnterpriseText3 as 'DESCRIPTION',
     PM.Proj_Outlinecode_name as 'PROJECTMANAGER',projent.ProjectEnterpriseText14 as 'BUDGET VARIANCE EXPLANATION',
     projent.ProjectEnterpriseText15 as 'SCHEDULE VARIANCE EXPLANATION',projent.ProjectEnterpriseText7 as 'AREAS_OF_CONCERN',
     projent.ProjectEnterpriseText4 as 'Explanation'

from      MSP_CUBE_PROJECTS cubeproj left outer join
     MSP_CUBE_ENTERPRISE_PROJECT_OUTLINE_1 CPN on cubeproj.ENTERPRISE_PROJECT_CODE1 = CPN.PROJ_OUTLINECODE_ID left outer join
     MSP_CUBE_ENTERPRISE_PROJECT_OUTLINE_16 PM on cubeproj.ENTERPRISE_PROJECT_CODE16 = PM.PROJ_OUTLINECODE_ID left outer join
     MSP_VIEW_PROJ_PROJECTS_ENT projent on cubeproj.proj_uid = projent.ent_projectuniqueid
 
where ENTERPRISE_PROJECT_CODE10 = 91

This is the error message I get:Server: Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'declare'.
fusionfx2000Asked:
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.

knightEknightCommented:
put the insert statement under the declare:

declare @cur_date as datetime
set @cur_date = getdate()

INSERT INTO FRA

0
knightEknightCommented:
or skip the declare altogether and just do this:

select      getdate() as 'DATEPOSTED'  ...
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.