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)
 Dynamically Create Procedures?

Author  Topic 

styl1n
Starting Member

1 Post

Posted - 2006-12-04 : 07:23:24
Hi, i'm trying to create a stored procedure inside a transaction. It makes perfect sense for what i need to do because it may need to be rolled back although it's a little unconventional. I am, of course, getting a syntax error when i try to run the script.

Is this even possible? I'm running 2005 by the way.

Any help would be appriciated.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-12-04 : 07:26:37
It's only possible through Dynamic SQL and not at all advisable.

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-12-04 : 07:31:04
>> It makes perfect sense for what i need to do
I doubt it.
Better to drop the SPs if something goes wrong.

If you do it inside a transaction you will be locking system tables and could cause problems.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-12-04 : 09:11:45
www.sommarskog.se/dynamic_sql.html

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-12-04 : 11:58:45
Instead of trying to use technology to sledgehammer a solution, why not tell us it is what you are trying to accomplish



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -