Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Updating text in sproc rather than altering

Author  Topic 

schinni
Yak Posting Veteran

66 Posts

Posted - 2003-12-19 : 22:50:05
Hello,
I have a situation where i need to update the text of the
sproc rather than altering
i can write a query to get the text of sproc using syscomments and
sysobjects..
i can use patindex...and get the text what i want to update in sproc

Is this possible...at all,if so can anybody helpme


Thanks..

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2003-12-20 : 03:18:42
I dont think that's a good idea. Keep your hands off the system tables if you want to keep your job! Even if you did get the procedure text, you won't be able to update syscomments directly without running an ALTER PROC...

What is it exactly that you are trying to do here? Maybe there is a better way?

Owais

We make a living out of what we get, but we make a life out of what we give.
Go to Top of Page

schinni
Yak Posting Veteran

66 Posts

Posted - 2003-12-20 : 12:52:21
Yes,I know that's not a good idea i thought there is something
other than updating syscomments table..

What i am trying to do is in my stored proc is to backup the datbase
to a path like this 'C:\backupi have a path hardcoded to sent the files to that path but i
want to change only that path most easiest way whenever necessary


Thanks,
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-12-20 : 17:51:26
Just pass a parameter to the procedure:

CREATE PROCEDURE BackupMyDB @backupfile @varchar(255) AS
BACKUP DATABASE MyDB TO DISK=@backupfile


You never need to change the procedure code, just call the procedure and pass the file name:

EXEC BackupMyDB 'C:\anotherpath\anotherfile.bak'
Go to Top of Page

schinni
Yak Posting Veteran

66 Posts

Posted - 2003-12-20 : 22:07:52
I got an idea for that i need to know if i can disable an step
in a job.

for example...
Suppose i have two steps in a job is there a way i can disable or skip
a step using "t-sql" whenever i need..


Thanks,
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2003-12-21 : 08:53:24
You could have that part of the job look up a configuration table for settings and exit if it's not needed. But you haven't given much info.



Damian
Go to Top of Page
   

- Advertisement -