I need to pick the max(date) to insert into another table

Hi Experts,
I have a situation ... I need to enter the details of a data load into an audit table..
I am loading the data from sales force object and once the data load is done, I need to enter the details of the load into audit table... I need to pick the max(LastModifiedDate) and enter the value in the audit table..
For ex.
I loaded the Account table with 1 million records...
Once the load is done,
I created a stored procedure to enter the values into the audit table..But I'm not able to populate the max(LastModifiedDate)...

AUDIT TABLE Structue :
ID int,
JOB_NAME varchar(100),
STATUS varchar(100),
JOB_RUN_TIME varchar(100)

The insert statement I gave :
insert into audit values ('10','ACCOUNT','SCUCCESS',"need to populate the max(LastModifiedDate) of Account table")..

Can any one help me out on this please?

You could do:

insert into [audit] (id,job_name,[status],job_run_time)
select 10,'ACCOUNT','SCUCCESS',max(lastmodifieddate) from [account]

btw: success is spelled wrong.

1 Like

Thanks a lot bro...!!! It worked...Appreciate your timely help!!!
I corrected the spelling of Suceess as well :slight_smile: