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.
| Author |
Topic |
|
Weicheng
Starting Member
5 Posts |
Posted - 2009-07-21 : 06:14:40
|
| Hi all,I know sql server doesn't allow calling of stored procedure from within function. But is there any way around it? does OPENQUERY help?My stored procedure inserts into a table, no value to be returned.Many thanksWei |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2009-07-21 : 06:23:30
|
| As far as I know noFunctions are extremely limited. They cannot perform any operation in any way that can change data. This means that you can't use dynamic sql or call other objects (except functions)What are you trying to do exactly?Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
Weicheng
Starting Member
5 Posts |
Posted - 2009-07-21 : 06:28:24
|
| For historic reason, some activity was done in a function, I need to log the activity using stored procedure which insert into log table. |
 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2009-07-21 : 06:44:30
|
| what do you mean some activity? A function can't change anything so what did it do that you want to log?Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
Weicheng
Starting Member
5 Posts |
Posted - 2009-07-21 : 08:47:33
|
| The function write to flat file |
 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2009-07-21 : 08:53:39
|
| I'm sorry I don't understand how that could have been possible (writing data to a flat file INSIDE a function).Are you migrating from a different database vendor?how are you using the function? Maybe if you want it to *do* something to some data or other object you should rewrite it as a stored proc and use OUTPUT parameters.you could post the code or explain exactly what you are trying to do. You aren't exactly forthcoming with lots of information.Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-07-21 : 09:03:58
|
can you use stored procedure to do the job ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|
|
|