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'.