I have 2 tables: table one is for all the data, table two is filtered data
from table one. I want to shedule this job and do it every night, i.e. every
end of the day (00:00), I want to use a sheduled T-Sql statement to get all
today's data from table one and insert those meet the criteria into table
two.
I don't know how to:
1. Where to schedule such kind of a job?
2. What T-SQL should I use? SELECT INTO seems like not be able to add
records to a existing table."JL" <ljmagzine@.hotmail.com> wrote in message
news:O0kCcf00DHA.3216@.TK2MSFTNGP11.phx.gbl...
> I have 2 tables: table one is for all the data, table two is filtered data
> from table one. I want to shedule this job and do it every night, i.e.
every
> end of the day (00:00), I want to use a sheduled T-Sql statement to get
all
> today's data from table one and insert those meet the criteria into table
> two.
> I don't know how to:
> 1. Where to schedule such kind of a job?
> 2. What T-SQL should I use? SELECT INTO seems like not be able to add
> records to a existing table.
>
Sql Server Agent can schedule the job.
Make it a TSQL job, and run something like
"
delete from table2
insert into table2
select * from table1
where col=1234
"
David|||Hi,
1. Where to schedule such kind of a job?
Use SQL Agent to Schedule the Job. But Ensure that SQL Agent service
runs all the time. Go to
How to:
1. Select Enterprise manager
2. Choose Management
3. Select SQL Server Agent option
4. Select Jobs
5. Right click above jobs and create new Job
6. There in step option you can create a TSQL Job and use schedule
option to schedule the Job
2. What T-SQL should I use? SELECT INTO seems like not be able to add
records to a existing table.
Use Insert into Select statement , the statement looks like
Insert into table2(columns) select column1,col2 from table1 where
conditions.....
The above statement you can incorporate inside your job ...Step.
Thanks
Hari
MCDBA
"JL" <ljmagzine@.hotmail.com> wrote in message
news:O0kCcf00DHA.3216@.TK2MSFTNGP11.phx.gbl...
> I have 2 tables: table one is for all the data, table two is filtered data
> from table one. I want to shedule this job and do it every night, i.e.
every
> end of the day (00:00), I want to use a sheduled T-Sql statement to get
all
> today's data from table one and insert those meet the criteria into table
> two.
> I don't know how to:
> 1. Where to schedule such kind of a job?
> 2. What T-SQL should I use? SELECT INTO seems like not be able to add
> records to a existing table.
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment