Slightly OT: FTView to SQL Server

Join Date
Jul 2007
Location
Kiruna
Posts
600
Hi Guys,

I'm not much of a SQL person so I was hoping for a digout on the correct way to approach this...

I am logging data to multiple SQL databases via ODBC from datalog models in FTView. The data I use to generate daily reports using Microsoft Reporting services.

What I have discovered:
- FTView does not purge the database as expected.

-If I use SQL queries to delete data older than 90 days the database does not shrink despite the Auto shrink feature turned on in SQL Management Console.

My question is as follows:

If I use the WIndows Task scheduler to run a batch file which executes SQL queries to delete the data can I run a shrink in the same script or must I wait. If i do from the Management console it might take 20 seconds to delete the data.

USE TRENDS_DB;
DELETE FROM dbo.FloatTable
WHERE DateAndTime < GETDATE()-60;

USE STATS_DB;
DELETE FROM dbo.FloatTable
WHERE DateAndTime < GETDATE()-90;

Can I add this code immediately after?

DBCC SHRINKDATABASE (TRENDS_DB, 10);
GO
 
I would probably use a SQL Task for this instead of a Windows Task. Assuming you are talking to SQL servers that are licensed for Agent use.
 

Similar Topics

I have been tinkering with a little DIY remote access stuff lately, prompted by some recommendations and challenges on this forum. To my...
Replies
5
Views
1,853
I need a little sanity check and hopefully advice from some experienced users. I have a mechanism that we're driving with a JVL MAC3000...
Replies
4
Views
1,146
Looking for an economic way to monitor kWh and kVARh on multiple circuits (up to 10) in a single distribution board. The Square D Power Logic...
Replies
3
Views
1,719
Does anyone make a "positioning cylinder" like the Festo DDPC but with a digital encoder feedback ? I have an application where a 0.0005 mm...
Replies
5
Views
1,776
This is a little OT, but I would like some general input. I have an machine control cabinet with an HMI as well as numerous standalone LED-bulb...
Replies
15
Views
6,579
Back
Top Bottom