Hi guys,
I started "autopurging" discussion many days ago.As I couldn't do it,so I decided to change my database into SQL Server.And so posted this problem here.
Plain and simple ------ I have a database named TANI and it has a table named "TANI" as well.
Table TANI has 3 fields only ------
1. CSV FILES that holds a link to some csv files from a folder
2. IMAGE FILES that holds a link to some image files from a folder
3. DATE that records the time of data arrival in the database.
Now, I just want to delete files ( both csv and image files ) from the folder INSPECTION that are 1 month old by using SQL Server triggers.
Can anyone help me this time?
Zerin
6 2118
Try this. Just test it first.
[PHP]
CREATE TRIGGER tIUD_machine ON machine
FOR INSERT, UPDATE,DELETE
AS
BEGIN
DELETE FROM INSPECTION
FROM INSPECTION I
JOIN TANI T ON I.[CSV FILES] = T.[CSV FILES]
AND I.[IMAGE FILES] = T.[IMAGE FILES]
WHERE DATE < dateadd(m,-1,getdate())
END [/PHP]
Try this. Just test it first.
[PHP]
CREATE TRIGGER tIUD_machine ON machine
FOR INSERT, UPDATE,DELETE
AS
BEGIN
DELETE FROM INSPECTION
FROM INSPECTION I
JOIN TANI T ON I.[CSV FILES] = T.[CSV FILES]
AND I.[IMAGE FILES] = T.[IMAGE FILES]
WHERE DATE < dateadd(m,-1,getdate())
END [/PHP]
Dear iburyak ,
Thanks for the reply.Testing now.And 'll let u know.
Zerin
Try this. Just test it first.
[PHP]
CREATE TRIGGER tIUD_machine ON machine
FOR INSERT, UPDATE,DELETE
AS
BEGIN
DELETE FROM INSPECTION
FROM INSPECTION I
JOIN TANI T ON I.[CSV FILES] = T.[CSV FILES]
AND I.[IMAGE FILES] = T.[IMAGE FILES]
WHERE DATE < dateadd(m,-1,getdate())
END [/PHP]
Dear iburyak ,
I tried the trigger and it gives the following error message: Object 'machine' does not exist or is invalid for this operation.
Actually,I'm not expert in SQL Server.So,I can't understand what to do.MSDN search also don't have any fruitful reply.Please help !
Zerin
Sorry, I just wrote table name that I have in my database you had to replace it with your test table name.
You have to change this line.
[PHP]CREATE TRIGGER tIUD_table_name ON table_name_here[/PHP] tIUD_table_name - trigger name table_name_here - should be a table name you creating trigger over.
Good Luck.
Oh !
What a foolish buddy am I ! I should'v noticed that. Thank u iburyak. Think it'll work now. Many many thanks frnd.
Zerin
Dear iburyak ,
It worked with a few change and I could do it by VB 2005 also.Ah! Relax.....................
Sign in to post your reply or Sign up for a free account.
Similar topics
by: georgios zakitraxis |
last post by:
Hi all,
I have a folder with many pictures in it.
All have the name like: HHMMDDMMYYYY.jpg
H-hour
M-minute
D-day
M-month
Y-year
|
by: Rosa |
last post by:
Hi,
I'm trying to clear the TIF on Windows XP programmatically with the
below code.
This code works fine on any folder but the TIF. For some reason the
atEnd() statements always defaults to true...
|
by: Bob Darlington |
last post by:
I have a repair and backup database routine which runs when a user closes
down my application.
It works fine in my development machine, but breaks on a client's at the
following line:
If...
|
by: Martin Bischoff |
last post by:
Hi,
I'm creating temporary directories in my web app (e.g. ~/data/temp/temp123)
to allow users to upload files. When I later delete these directories (from
the code behind), the application...
|
by: Sandeep Singh Sekhon |
last post by:
I am Developing a Web Application with ASP.NET 1.1
I have one project Folder which is virtual directory of IIS.
In this directory, I have one Folder named Photos in which I used to
Store Photos....
|
by: jawloc |
last post by:
Hi I have a question that I hope someone can help me with. I have
created a web page that allows a user to upload an image with a
caption to my web server. Here is what happens when the user...
|
by: rahuldhammy |
last post by:
I am implementing a personalization(customizing the contents of the web site according to the user choice)in asp.net web site.For this i have to delete modify some files in my App_Themes folder.I am...
|
by: =?Utf-8?B?TWFyZWs=?= |
last post by:
Hi
Sorry for the newbie question, but is it possible to stop the publish
operation from Visual Studio 2005 deleting files in a specific folder on the
web server? I have an uploads folder on the...
|
by: divyakgowda |
last post by:
Hello,
For my ruby on rails application,i need to delete all the temporary files created in /tmp folder.If those files increases, at some point in time, my application stops working unless i...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |