Re: Running Periodic Tasks



On 18 Jan 2006 in alt.2600, Perfect Reign <theperfectreign@xxxxxxxxx>
made their contribution to mankind by stating in
news:5kjoeltrlq9o.nhms4fb38rt2.dlg@xxxxxxxxxx:

> On 18 Jan 2006 16:10:59 GMT, someone posing as ThePsyko took a five
> minute break from flipping burgers to boot up the etch-a-sketch and
> scribbled:
>
>
>>>
>>> What are your thoughts/experiences? Could DTS handle this or should
>>> I be looking at an app? If I'm running an app, should it simply be a
>>> scheduled task (AT/Schtasks) or run as a polling service? Also would
>>> MSMQ be relevant here?
>>>
>>> I want a beer.
>>
>> Couldn't you write a .sql file to dump the data from DB1 into a flat
>> file, use the DB2 utility to import, process and export the file,
>> then have another .sql file reimport the data to DB1?
>
> A .sql file? You mean one created by isqlw?

..sql files.. basically a .txt file with an .sql extension that contains sql
commands :)

for example:

/**************************************/
/* TABLE STRUCTURE CHANGES */
/**************************************/

/* tblContacts */


PRINT ' Adding column PrivateStatus to tblContacts... '

if not exists (select * from syscolumns where id = object_id(N'[dbo].
[tblContacts]')
and name = 'PrivateStatus' )
BEGIN
ALTER TABLE tblContacts
ADD [PrivateStatus] [tinyint] NULL
END
ELSE
BEGIN
PRINT 'Column exists...'
END
GO

***END C&P***

that's from the last .sql file I ran. You can execute it from within SQL
Enterprise manager. I'm sure there's a way to schedule it as well. Not
sure though since I don't do much with MSSQL unless I have to.


>
> I could setup a DTS to export a query out to a flat file.
>
> In fact, here's a current look at the query I'm messing with...
>
> SELECT
> afm.wrcf.wr_id as WorkOrder,
> afm.wrcf.cf_id as UserID,
> afm.wrcf.comments as Description,
> (CAST(DATEPART(mm, afm.wrcf.date_assigned) AS nvarchar)
> + '/' + CAST(DATEPART(dd, afm.wrcf.date_assigned) AS
> nvarchar) + '/' + CAST(DATEPART(yyyy,
> afm.wrcf.date_assigned) AS nvarchar) ) as DateAssigned,
> (select convert(varchar, afm.wrcf.time_assigned, 114)) as
> TimeAssigned, afm.wr.ac_id as Account,
> afm.bl.address1 as Building,
> afm.city.name as City,
> afm.city.state_id as State,
> afm.bl.zip as Zip
>
> FROM afm.wrcf, afm.wr, afm.bl, afm.city
>
> WHERE
> afm.wr.wr_id = afm.wrcf.wr_id
> AND
> afm.wr.bl_id = afm.bl.bl_id
> AND
> afm.bl.city_id = afm.city.city_id
>
> ORDER BY
> afm.wrcf.wr_id
>
>
> That part is pretty much done. This is a pathetic database which is
> completely un normalized. (Is that a word?)

it is now :)


>
>
>> You'd have to know how
>> long the processing by DB2 will take so you can have an idea when to
>> schedule the second .sql file, but it should work.
>
> Hmm. Interesting point. Processing generally takes less than a second.
>
> Thanks for the tip. I'll follow up.
>
>



--
ThePsyko
Public Enemy #7
http://prozac.iscool.net
.



Relevant Pages

  • Re: Running Periodic Tasks
    ... >> be looking at an app? ... > have another .sql file reimport the data to DB1? ... I could setup a DTS to export a query out to a flat file. ... here's a current look at the query I'm messing with... ...
    (alt.2600)
  • Re: Importing Query From .sql file?
    ... Activex task is basically to open the sql file containing query and to read ... i hv done it using "transform data task" making an ole db connection where i ...
    (microsoft.public.sqlserver.dts)
  • Re: Automating Script Execution
    ... ----Run .sql file ... > I currently have a complex .sql script that produces several result sets ... I have tried running the script through isql.exe at the comand line, ... query and not the results set itself. ...
    (microsoft.public.sqlserver.programming)
  • Re: Importing Query From .sql file?
    ... Activex task is basically to open the sql file containing query and to read ... But nw i need to open various sql files containing queries ... i hv done it using "transform data task" making an ole db connection where i ...
    (microsoft.public.sqlserver.dts)
  • Re: Time Zone Date variables
    ... Dale ... >I am connected to a SQL file with a date field as a data type = ... >>It displays as an interger in my query. ... > It is a ten digit numeric field. ...
    (microsoft.public.access.queries)