Friday, March 30, 2012

Job to truncate database records more than 15 days old

I have a SQL Server 2K db with some 10 tables and I want to setup a nightly job to truncate all db records which are more than 15 days old. Can anyone provide me with steps involved? Any help will be highly appreciated.You do have a datetime field with the record createion date on the tables, right?

And you do not have any relational integrity that may get in your way?|||Thats correct.|||Then create a stored procedure perform,ing the delete and let it run nightly. SQL Server Assistant has to be running for this to happen. Pretty staraightforward.sql

job to run a remote process

I have a question regard the scheduling of a database job. I want to run a job that executes the following steps:

1) backup an entire database from DB server A

2) restore the database on DB Sever B

3) run a non database process on Server C (with xp_cmdshell)

Step 1 and 2 are easy enough but how do I start a process on an remote machine (Step 3)?

In my case the process in step 3 is will execute a Cognos DecisionStream job (rundsjob.exe)

My environment is

SQL Server 2000.

Windows Server 2003

Paul

If you are trying to do something like run a batch file remotely, you may want to look at WMIC.

Prior to Windows 2003, you'd use RCMD. This link might help you get started:

http://www.microsoft.com/technet/prodtechnol/windows2000serv/maintain/featusability/wmic.mspx

-Sue

job to read the zip file and insert db

Hi,
I need to grab the zip file on ftp server periodically,
and the zip file contains one text file, then I need to
insert the records into db, Iwould like to automate the
process. How can set it up?
ThanksHi,
Try using pkunzip and BCP IN utilities to perform this.
Thanks
Hari
MCDBA
"Jen" <anonymous@.discussions.microsoft.com> wrote in message
news:0f2101c3b476$4bfeb470$a001280a@.phx.gbl...
> Hi,
> I need to grab the zip file on ftp server periodically,
> and the zip file contains one text file, then I need to
> insert the records into db, Iwould like to automate the
> process. How can set it up?
> Thanks|||Jen,
You can use wzunzip.exe (WinZip command-line) to unzip the file. You can use
ftp -s <filename> to script the ftp (or use something like www.webdrive.com to
make the ftp server look like an NT drive). You can use bcp.exe or bulk insert
or dts to insert the records.
Pull it all together with a few lines of batch file.
> I need to grab the zip file on ftp server periodically,
> and the zip file contains one text file, then I need to
> insert the records into db, Iwould like to automate the
> process. How can set it up?
> Thanks
>
Neil Pike MVP/MCSE. Protech Computing Ltd
Reply here - no email
SQL FAQ (484 entries) see
http://forumsb.compuserve.com/gvforums/UK/default.asp?SRV=MSDevApps
(faqxxx.zip in lib 7)
or www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
or www.sqlserverfaq.com
or www.mssqlserver.com/faq

Job to Execute SSIS package fails

This question has been asked earlier in this forum. But, I still didn't get the correct resolution of my problem.

I am trying to run the DTS package from my filesystem.

Command Line:
/FILE "C:\SSIS\IS\bin\Package1.dtsx" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF

Executed as user: FILESERVER\SQLServiceQA. The command line parameters are invalid. The step failed.

Can anyone please let me know whats the problem with it.

I am not using any Script Task in the package.

Thanks.Does it run if you execute the same command line as the same user using DTExec? If so then you should probably post to the agent forum. If not then what errors do you get when running it from DTExec?

Thanks,
Matt

job to delete the old baks

How do I write a job to delete the old backup files. I do not want to use
Maintenance plan. I would like to write a sql job to perform this activity.
Is there any procedure for this
ThanksHi,
Have a look into the old post:-
http://groups.google.co.in/group/microsoft.public.sqlserver.server/browse_thread/thread/49bf865107573571/93d87002b75a5a0f?q=sql+server+script+to+delete+old+backup+files&rnum=6&hl=en#93d87002b75a5a0f
Thanks
Hari
SQL Server MVP
"Pari" <Pari@.discussions.microsoft.com> wrote in message
news:256D7D14-D04F-4195-A065-CA920A1F9AC6@.microsoft.com...
> How do I write a job to delete the old backup files. I do not want to use
> Maintenance plan. I would like to write a sql job to perform this
> activity.
> Is there any procedure for this
> Thanks

job to delete the old baks

How do I write a job to delete the old backup files. I do not want to use
Maintenance plan. I would like to write a sql job to perform this activity.
Is there any procedure for this
ThanksHi,
Have a look into the old post:-
http://groups.google.co.in/group/mi...3d87002b75a5a0f
Thanks
Hari
SQL Server MVP
"Pari" <Pari@.discussions.microsoft.com> wrote in message
news:256D7D14-D04F-4195-A065-CA920A1F9AC6@.microsoft.com...
> How do I write a job to delete the old backup files. I do not want to use
> Maintenance plan. I would like to write a sql job to perform this
> activity.
> Is there any procedure for this
> Thanks

job to delete the old baks

How do I write a job to delete the old backup files. I do not want to use
Maintenance plan. I would like to write a sql job to perform this activity.
Is there any procedure for this
Thanks
Hi,
Have a look into the old post:-
http://groups.google.co.in/group/mic...d87002b75a5a0f
Thanks
Hari
SQL Server MVP
"Pari" <Pari@.discussions.microsoft.com> wrote in message
news:256D7D14-D04F-4195-A065-CA920A1F9AC6@.microsoft.com...
> How do I write a job to delete the old backup files. I do not want to use
> Maintenance plan. I would like to write a sql job to perform this
> activity.
> Is there any procedure for this
> Thanks