473,399 Members | 3,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

T-SQL too big for Task Scedule - HELP!

SQL Server 6.5

My clients are troubled by a growing Transaction log, but they don't
want a lot of expensive maintenance as the contract is about to expire.
The database used to be marked for replication, but it seems almost
impossible to stop records being written to the Transaction log even
though there are no Publishers and no Subscribers. Thus the
transaction log fills up with publication transactions for which there
is no subscriber. Various on-line sources suggest marking all such
records as "complete", allowing the log to be truncated (this works -
I've tested it in the query window)

I suggested a Scheduled Task to truncate the log, and I want to put
this script into a task:

use master
go
sp_configure 'allow', 1
go
reconfigure with override
go
begin tran
update master..sysdatabases set category = 1 where name = 'WidgetData'
commit tran
use WidgetData
go
sp_repldone 0, 0, NULL, 0, 0, 1
dump tran WidgetData with truncate_only
update sysobjects set category = category & ~32
update sysobjects set category = category & ~64
use master
go
update sysdatabases set category = 0 where name = 'WidgetData'
go
sp_configure 'allow', 0
go
reconfigure with override
go
However, the text box where I can enter the SQL truncates at 231
characters.

What can I do, short of running the job myself? Can I split it into
two or more tasks? If so, where should I split it? And can I
establish a dependency between them so that, in the event of one task
failing, the other(s) don't execute.

Your help would be greatly appreciated.

Edward

Jul 23 '05 #1
4 1424
(te********@hotmail.com) writes:
However, the text box where I can enter the SQL truncates at 231
characters.

What can I do, short of running the job myself? Can I split it into
two or more tasks? If so, where should I split it? And can I
establish a dependency between them so that, in the event of one task
failing, the other(s) don't execute.


But the script in a file and the run the job as a command-line job that
fires up the script with ISQL.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #2
Erland Sommarskog <es****@sommarskog.se> wrote in message news:<Xn*********************@127.0.0.1>...
(te********@hotmail.com) writes:
However, the text box where I can enter the SQL truncates at 231
characters.

What can I do, short of running the job myself? Can I split it into
two or more tasks? If so, where should I split it? And can I
establish a dependency between them so that, in the event of one task
failing, the other(s) don't execute.


But the script in a file and the run the job as a command-line job that
fires up the script with ISQL.


Could I please check that I have this correct?

I put the script into a file - let's say, "myquery.sql"

The Type of the task changes from TSQL to CmdExec.

In the command window I enter:

isql.exe /i myquery.sql

Is that it? If so, where should myquery.sql be located, for isql.exe
to find it? Or do I need to supply an absolute path? And should the
path be in quotes?

Normally I would research this myself, but as I stated in my original
post this contract only has a few weeks to run, and the new contract
is on SQL 2k so this won't be an issue.

Many thanks again.

Edward
Jul 23 '05 #3
Edward (te********@hotmail.com) writes:
Could I please check that I have this correct?

I put the script into a file - let's say, "myquery.sql"

The Type of the task changes from TSQL to CmdExec.

In the command window I enter:

isql.exe /i myquery.sql

Is that it? If so, where should myquery.sql be located, for isql.exe
to find it? Or do I need to supply an absolute path? And should the
path be in quotes?


As with any other command-line utility, ISQL will read from the current
directory. This is, if memory serves, %WINNT%/SYSTEM32. It goes without
saying that this is not a good place to put query script. So an absolute
path is to recommend. Quotes you need if the path contains special
characters.

It's also good to specify /o to get an output file. And /n to be saved from
all the 1> 2> etc.


--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #4
Sounds like the ideal thing is to put the database in Simple mode so it does
not write a log. However if SQL Server thinks the database is still marked
for replication it will not allow you to do this.

Sometimes SQL is not too clever at removing the information marking a db for
replication, I have had trouble with this in the past, but I eventually have
succeeded in removing it (unfortunately I cannot remember the exact steps).
A search on google should provide a few clues.

You could try copying the db to a server that is not enabled for replication
(either file copy or backup and restore), which should give you an unmarked
database that you can copy back.

<te********@hotmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
SQL Server 6.5

My clients are troubled by a growing Transaction log, but they don't
want a lot of expensive maintenance as the contract is about to expire.
The database used to be marked for replication, but it seems almost
impossible to stop records being written to the Transaction log even
though there are no Publishers and no Subscribers. Thus the
transaction log fills up with publication transactions for which there
is no subscriber. Various on-line sources suggest marking all such
records as "complete", allowing the log to be truncated (this works -
I've tested it in the query window)

I suggested a Scheduled Task to truncate the log, and I want to put
this script into a task:

use master
go
sp_configure 'allow', 1
go
reconfigure with override
go
begin tran
update master..sysdatabases set category = 1 where name = 'WidgetData'
commit tran
use WidgetData
go
sp_repldone 0, 0, NULL, 0, 0, 1
dump tran WidgetData with truncate_only
update sysobjects set category = category & ~32
update sysobjects set category = category & ~64
use master
go
update sysdatabases set category = 0 where name = 'WidgetData'
go
sp_configure 'allow', 0
go
reconfigure with override
go
However, the text box where I can enter the SQL truncates at 231
characters.

What can I do, short of running the job myself? Can I split it into
two or more tasks? If so, where should I split it? And can I
establish a dependency between them so that, in the event of one task
failing, the other(s) don't execute.

Your help would be greatly appreciated.

Edward

Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: rashika | last post by:
Hi : Can i call 2 procs within one task? I have sp_proc1 ? (and have declared one global variable as input parameter) now i have another sp_proc2 which uses same input parameter but if i...
2
by: Dino Buljubasic | last post by:
Hi, Does anybody know how can I close my app and remove it from Task Manager? I have an application that has a log in form and several others. User can close application from Log In form or...
2
by: AllenM | last post by:
I have a project that requires an XML webservice that will receive an xml file. The webservice will need to read the XML file, download a pdf file from a URL stored in the XML file then store the...
4
by: Neil | last post by:
Hi, I am having problems in trying to create a scheduled task from within in application that carries out a health check on a client. I am using VS 2005. When the program runs it flashes a...
3
by: Amy Newsome | last post by:
TO DO TASK Need help with programming the ADD button I have a textbox called txtinput where I will enter a task After hitting an add button the program should put the text into a listbox...
0
by: vbace2 | last post by:
DB2 9.1 fixpak 2 on Windows I am trying to set up a task in the task center that will run on a daily basis to check for an "issue". To find this "issue", I run a select statement that brings back...
2
by: sensai | last post by:
Hi guys, I'm new to Python and have a ? that some of you can maby help me on. I'm using python 2.4 and running the script from a windows machine getting data from a linux machine. I have a...
2
by: thoffman | last post by:
Hello again everyone! I have an issue that I can't seem to find a straight answer for anywhere... I have a For loop that sends a file name to a background worker that contains some long running...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
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...
0
agi2029
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.