SQL Server 2008 :: Delete Folders / Sub Folders Older Than N No Of Days

Jul 30, 2015

If I run the below command, it clean up the files inside the folders but unable to clean up the folder and sub-folders older than 30 days. xp_ cmd shell ' forfiles -p "D:abcd" -s -m *.* -d -30 -c "cmd /c del /Q @path"'

View 4 Replies


ADVERTISEMENT

T-SQL (SS2K8) :: Function To Create Folders (and Sub Folders)

Jun 5, 2014

I'm using sp_OACreate in a scalar function to create a folder if it doesn't exist, and it works fine if you're asking it to create a single folder. For instance: C:Newfolder

It creates "Newfolder"

However, if I try to ask it to create C:NewfolderNewsubfolder

It doesn't work

Here's the code:

DECLARE @Exists int, @ObjFile int, @ObjFileSystem int, @Folder nvarchar(500) = 'C:',
@Action tinyint = 1 --(0 to check if folder exists, 1 to actually create it)

EXEC dbo.sp_OACreate 'Scripting.FileSystemObject', @ObjFileSystem OUT
EXEC dbo.sp_OAMethod @ObjFileSystem, 'FolderExists', @Exists OUT, @Folder

[Code] .....

View 1 Replies View Related

Delete Records Older Than 5 Days .

Aug 20, 2002

Hello ,

I am little confused in writing the exact query i.e filling the correct details in the query .
To simplify let me explain....

I am using the query as

delete MYTABLE
where datediff(dd,loaddate,getdate())>5

I have a table now with loadate column which gets the default date and time . The loadate shows correct date and time when the data was imported in the table .

Now suppose if i want to delete previous 5 days records from today
( for e.g today is 20/08/2002 3:40:00 PM ) ideally it should delete all records which are 5 days older from today . i.e from 20/08/2002 3:40:00 PM to 15/08/2002 3:40:00 PM )
But when i execute the datediff command , it deletes the records previous than 15/08/2002 till 15/08/2002.
The records from 15/08/2002 to 20/08/2002 remain intact .

I am getting some different results .

Am i missing something in the query or i am confused about the calculation of the dates the datediff command performs .

Is the logic correct or i am missing someting important ?

Thanks and Regards
Admin001

View 1 Replies View Related

Delete Records In A Table Older Than 90 Days . Help

Aug 5, 2002

Hi ,

I have a scheduled job which does an text file import in my database . The data gets appended in my table every day from this import job .

Since my table is growing every day , i want to truncate the table after the data has been collected for three months i.e 90 days . The table will be empty and the new data will flow in through the import .

Any thoughts how to do it through query and schedule it ???

Thanks

View 1 Replies View Related

How To Delete Data Older Than X Days, Without Considering Time

Nov 11, 2005

When running the following SQL statements, I get the same results.Though I need to count only -30 days. Both statements below alsoconsider the time of the day as well, which is not desiredDELETE FROM MNT_RWHERE MNT_R.TIMESTAMP < GETDATE()- 30DELETE FROM MNT_RWHERE MNT_R.TIMESTAMP < DATEADD(d, -30, GETDATE())Here is the format of the values in columnMNT_R.TIMESTAMP2005-08-09 06:06:44.5772005-08-09 06:06:46.8102005-08-09 06:06:49.060So, since data are inserted into the MNT_R table every few seconds, mydelete statement will delete different number of rows, according to thetime of the day it runs.Can you please post a SQL query that will not give me this headache?thanx a lot all

View 2 Replies View Related

Delete Files Older Than 3 Days Using SSIS Tasks

Aug 11, 2006

I want to delete all files in a given folder that are older than 3 days from today's date.

I tried using a "Foreach Loop container" with a "File System" task inside it but found I couldn't access any file properties such as the file creation date. Am I using the wrong task for this job?



TIA,



Barkingdog



P.S. History of the problem:

I used the sql 2005 Database maintenance program to setup our database backup jobs. One day I noticed that the free space on the drive where we keep the dumps had grown small. I found that we had at least 4 weeks of dumps in there, not the 3 days I wanted to keep! I looked but could not find the "delete file" option in the SSIS package generated by the Database Maintenance Wizard. No wonder the files were piling up.

View 14 Replies View Related

SQL Server 2008 :: Query To Delete All Backup Files Older Than A Specific Date?

Jul 29, 2015

I want to delete all backup files from a folder older than a specific date. But if I use the beklow query, I need to pass how many days of older backup files I need to delete whereas in my case, I dont know how many days/month/syears of old backup files are there in the backup folder.

EXEC xp_cmdshell 'FORFILES /p c:BACKUP /s /m *.sql /d -30 /c "CMD /C del /Q /F @FILE"'

View 2 Replies View Related

SQL Server Admin 2014 :: Backups To Different Folders Based On Week Day

Oct 25, 2014

I am trying to create a job that would backup a DB dynamically to a different folder based on the week day. So if it's Saturday, backup to folder Saturday.

I have this

DECLARE @BackupLoc nvarchar (100)
DECLARE @DayOfWeek nvarchar (100)
set @BackupLoc = N'D:Backup'
set @DayOfWeek = (SELECT DATENAME(dw,GETDATE()))
set @BackupLoc = @backuploc + @DayOfWeek

[Code] ....

But it's giving me permission errors, although the AGENT and MSSQL service accounts are members of the local admins group.

View 2 Replies View Related

Analysis :: How To Structure Source Control Folders In Team Foundation Server

Jun 11, 2015

How to integrate current artifacts with TFS ?

For example : We have multiple applications X, Y, Z  each has  its own SSIS solution , SQL Script, MSTR report and documentation.

We move code from Dev to Test and then to PROD

How to structure the folders which will be easy to manage and easy to release ?

View 3 Replies View Related

Two (2) App_Data Folders?

Apr 25, 2007

I loaded an application to my server with the app_data folder intact in the application folder which is a sub folder of the root web.
 Through my host enableing SQL somehow a second App_Data folder has been created in the root of the web and the db has been duplicated.  Without a doubt this is causing a problem with the application not running correctly.  The application is the asp.net membership app which is trying to read and write to the .mdf file.
 Can we simply delete the App_data folder in the the root web or will this rebuild itself?  Or do we need to edit the web config files?
How / Why did this happen?
 Server is running Win2k with SQL Express 2005
 TRU
 

View 2 Replies View Related

How To Add Folders In SQL 2005

Jun 13, 2007

does anyone have idea How to add folders in SQL 2005
thanks in advance

View 12 Replies View Related

Two MDF Files With Same Name In Different Folders

Apr 25, 2015

Is it OK to have two mdf files with the same name placed in different folders and attached with different names.

Example:
DATADB1Hotel.mdf attached as hotel1
DATADB2Hotel.mdf attached as hotel2

View 6 Replies View Related

How To Enumerate IS Folders ?

Dec 5, 2007



Hi All,

I need to get access to stored packages. To do so I use
Microsoft.SqlServer.Dts.Runtime.Application class.
There are methods: Application.FolderExistsOnDtsServer, Application.FolderExistsOnSqlServer
but I need to enumerate existed folders.
Are there something like: Application.GetFolders(String ParentFolderName) ?
I have searched in doc but there is not any useful except:



"To verify that the folder was created, the following Transact-SQL query selects all packages stored in the File System folder of the Stored Packages package store.

select * from sysdtspackages90 "

It is not suitable for me because I don't have permissions to access database

Thanks,
Sergiy

View 3 Replies View Related

Deploying To Sub Folders

Feb 21, 2008



hi all

using sqlserver 2005 Reporting Services

When I go to deploy

my main folder = Reports
my sub folder = reAct or Managers Reports or Onboarding etc

how do I deploy directly to the sub-folders?

thanks
jewel

View 13 Replies View Related

Dynamically Name Folders

Feb 12, 2007

Apologies in advance for the newbie question. I'm new to Integration Services and am trying to build my first project.

I want to dynamically create folders based on the results of a stored procedure. The resultset is limited to one column but can contain multiple rows. (It returns a list of 8-character strings representing dates.) This returned value needs to be combined with the path where the new folders should be created.

Can someone point me in the right direction? I've run the stored procedure and put the resultset into a RecordSet Destination that uses a variable of type Object. (At least, I think I've done it correctly.) But I have not been able to figure out how to access this data to actually create the folders.

Thanks for the help,

Chris

View 3 Replies View Related

SQl Dbase Query From Different Folders

Feb 4, 2008

HI, I have a Dbase Database stored in several subfolders. I allready made my connection with a sqldatasource and a gridview, and all works fine when i do a query with the tables in to root folder. The problem is when I try to include tables from the subfolders, the compiler send me a syntax error in the FROM Clausule
I Allready try this.
 SELECT products.id, products.descri, condition.discount  from products, clientscondition where products.line=condition.line
 SELECT producst.id, products.descri, clientscondition.discount from products, clientscondition where products.line=condition.line
 SELECT products.id, products.descri, condition.discount from products, condition in 'clients' where products.line=condition.line
 SELECT producst.id, products.descri, clientscondition.discount from products, 'clients'.condition where products.line=condition.line
And many other different combinations. I would like to be helped if you know the correct syntax or a link where i can consult the syntax for VB.net and dbase with several folders
Another option a tried is having a query from 2 different datasources, but I don´t know how to make a reference to the 2 sqldatassources in a new one to be linked to the gridview

View 7 Replies View Related

Hide Folders In Report Mng

May 12, 2008

Hi All,

I would like to control user access to my Report Manager.In detail,I would like to hide some report folders from certain users when they access the Report Manager.Some of the users are not suppose to see certain folders on the report manager,and some users are suppose to see all report folders.

How can I do this?.Where should I include this settings?

View 4 Replies View Related

Databases In Separate Folders?

Mar 15, 2006

In Enterprise Manager, is there a way to group Databases into Separate folders?

View 6 Replies View Related

Deleting Folders Using SQL Triggers

Jun 24, 2007

I need to delete the empty subfolders under my "uploads" folder

how can i perform that using triggers

i need to delete old records in database and the folders associated with them, i've used triggers to delete the records before 180 days, but i don't know how to remove the folders associated with each folder.

note:
name of folders is the same as record number

is that possible?

View 1 Replies View Related

Restricting Access To Certain Folders?

Jan 6, 2007

Hi all,

I have a user who I only want to provide access to a single folder within
RS2005. I don't seem to be able todo this, they can either see everything or
nothing at all.

What am I missing? Any help much appreciated.

Kind regards
Tarun

View 10 Replies View Related

Can You Create Folders Under Databases In SMS

Aug 20, 2006

I see under databases in the object explorer of SQL Server Management Studio that there are two sub-folders: System Databases and Database Snapshots.

Is there a way to create other folders here? It would be nice to be able to group the various databases (ex. Samples).

tia

View 1 Replies View Related

Granting Permission To Folders

Feb 12, 2008

Within my Report Manager, I have several folders, and I would like these folders to be only visible to certain users and groups. In the Active Directory I have DOMAINGroupName1. If I add this group to the folder I want them to have access to with a Browser role, when they open Report Manager they do not see the folder at all. Then I added the same group to the HOME folder also, but again they could not see their folder when they opened the Report Manager. If I add the Users of this group individually (DOMAINUser1, DOMAINUser2 etc) then they can see the folder and run reports just fine. This is not an ideal solution as groups will change over time and I don't want to have to keep adding and deleting members. Anyone got any ideas why they can't see their folder?
Thanks!

View 4 Replies View Related

How To Suft Through MSDB Folders?

Feb 7, 2007

Hi everyone,

Primary platform is Framework 2.0.

My target now is to know programatically how many folder exists under MSDB folder as well as its names.

How to accomplish this?

Thanks in advance and regards,

View 3 Replies View Related

Adding Folders Under The Solution

Jul 5, 2007

In RS, can one add a folder under the Reports folder? I don't see where I can do this. We work with many different state's and we would like to organize reports by state.



Thanks for the information.

View 4 Replies View Related

ReportServer Folders And Deployment

Oct 28, 2007

I am making changes to a report and believe I am correctly deploying it to an ssrs report folder per the messages I get back from vs.net.

Question is, how can I see what folders are available? and where? At some point I knew or was able to do this, and think it was through SQL server since I can't see them through IIS and they don't appear to be real file system folders.

Also, I'm trying to figure out why parameter default value changes i make don't seem to deploy or overwrite??, while cosmetic (color for example) changes do when I deploy. I am selecting the option overwritedatasource in the project.

If I navigate to the reportserver I see the folder in question.

http://myreopertserveriphere/reportserver

Thanks for any help or information!

View 7 Replies View Related

Removing My Reports Folders

Apr 24, 2008

I am the administrator for our Reporting Services environment. I was researching the functionality of the My Reports feature of Reporting Services 2005. I enabled the My Reports feature and SSRS created folders to accomodate this feature. I then experimented with linked reports.

Now I want to undo this feature. I turned off the My Reports feature but the folders remain. The Report Manager refuses to delete them. I found their entries in the ReportServer.Catalog table but don't want to just delete them.

Does anyone know how to remove these folders from the Report Manager?

Gordy

View 1 Replies View Related

Skipped Folders When Backing Up SQL To Tape.

Jun 28, 2002

Can someone please help in in understanding what I have done wrong. My company is using Backup Exec 7.3 as it's back up application. I have built a server, installed SQL, Built an database and added logins. I am backing up my database and Transact Log Files to specific folders on my partioned drive. Why when I run the backup ups, It backs up everything EXCEPT for my SQL folders. It seems to Skipp all SQL Folders. Please Help, I need to have this funtion working properly. What have I done wrong or what do I need to do to make this stop. Does this perhaps have something to dwil Here is an example of the backup Message in Backup Exec that I am recieving:

Media Name: "DIFF"
Backup of "FEPTESTE$ "
Backup set #41 on storage media #1
Backup set description: "Daily 6"
Backup Type: DIFFERENTIAL - Changed Files
Backup started on 6/28/02 at 12:36:21 AM.
The item Microsoft SQL ServerDataMSSQLDataTESTDB_Data.MDF in use - skipped.
The item Microsoft SQL ServerDataMSSQLDatamaster.mdf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDatamastlog.ldf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDatamodel.mdf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDatamodellog.ldf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDatamsdbdata.mdf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDatamsdblog.ldf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDataorthwnd.ldf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDataorthwnd.mdf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDatapubs.mdf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDatapubs_log.ldf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDataempdb.mdf in use - skipped.
The item Microsoft SQL ServerDataMSSQLDataemplog.ldf in use - skipped.
The item Microsoft SQL ServerDataMSSQLLOGTEST_Log.LDF in use - skipped.

Backup completed on 6/28/02 at 12:37:11 AM.
Backed up 48 files in 24 directories.
14 items were skipped.
Processed 23,876,604 bytes in 50 seconds.
Throughput rate: 27.3 MB/min

View 1 Replies View Related

How To Give Permissinon To Folders In SSRS

Mar 26, 2008

Hi,


I have one query in sql server reporting services securities.

In ssrs i have folders like(Custom reports, testreports,...). these folders are having reports. In this i want to give permissions to folders means if i gave permission to user1 to access the custom reports folder then he is able to access to that folder only and he is not able to access to any other foldes. How to give permissions to folders.

Pls any one help me on this.



Thanks
Ravuri

View 3 Replies View Related

Create Folders In Object Explorer - Wish...

May 4, 2007

Here's one thing that I'd like to see come out in some version of the SQL Server Management Studio...
The ability to create folders under the database node so that databases can be grouped on one server.

We have over 100 databases on our development server and these are created by a range of consultants and developers and even support staff as needed.

Being able to group the databases by product, etc would be a nice touch since we have client databases that don't fit naming conventions etc.

Multiple instances are another way around this but are expensive and resource hungry - we develop and support models, not use them for transactions too much.



Yes there are 'better' ways such as setting security correctly but we are too busy working and not maintaining.

Folders or database groups would be a nice touch.



Cheers

View 1 Replies View Related

Hiding Folders And List View

Jul 9, 2007

Hello I have a few questions hoping someone can help



Any way to hide a report completely ? ie data source folders, subreports called from hyperlinks etc



Anyway off hiding the List view and restrict the user from selecting list view ?



Anyway off customising the reporting services top area which is in yellow and black ie put a logo in this area ?



thanks

View 2 Replies View Related

File System And MSDB Folders Gone

Jul 27, 2007

This is terrible thing to happed at 4:30 pm on Friday!
I was working yesterday on some of deployment packages using file system (by the way, my msdb can not expand )
and just an hour ago I wanted to try some parent child deployment using file system.
but,
The only two folders I see in Integration services are Running Packages and Stored Packages. Nothing under those ones...
I have checked default location for File System (C:Program FilesMicrosoft SQL Server90DTSPackages) and there are three packages there but these do not show in IServices.
And another question, if I execute package by double clicking on .dstx file should that make it show under File System?

thanks

View 6 Replies View Related

Copy Folders And Files To Different Location

May 15, 2007



I have a situation from where I need to loop through different folders and files in these folders. After processing these files, I need to archive these folders to different location.



e.g., C:MainFolderMar01 ==> Multiple files in Mar01 folder

C:MainFolderMar02 ==> Multiple files in Mar02 folder



Does any one know the best way to do this in SSIS?



Thanks in advance.



BC

View 1 Replies View Related

Deploy Reports To Specific Folders

Jan 29, 2007

Hi, I am a new user for RS so this might be a very dump question for some of the advanced users here.

I am using SQL 2005 RS and was wondering how I can deploy reports to specific folders that I created on the Reports page. I do know that I can go to Properties to move the reports to different folders. But the problem I have is when I deploy the reports from VS 2005 ( I created the reports using VS 2005) they were deployed back to the old/root folder. How can I change the 'deploy-to' destination folder for the reports in VS 2005?

Many Thanks,

Casey

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved