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 |
|
sdiwi
Starting Member
27 Posts |
Posted - 2005-10-18 : 04:10:23
|
| Hi. I'm stuck at a little problem:I try to write a UDF that gets 2 parametersCREATE FUNCTION dbo.getNewID (@nameOfTable, @nameOfColumn)....What I want it todo isSELECT MAX(@nameOfColumn) FROM @nameOfTableThat means I would have to build my query inside the function. But i cannot call sp_executesql to execute my query. The only way (i know) that could be working is writing a stored proc. but i cannot access it's return value from another proc/function (no temp tables!). is there anything i could do? |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-10-18 : 04:22:31
|
no.the function has to be deterministic which is not when using dynamic sql inside.Go with the flow & have fun! Else fight the flow |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-18 : 04:37:26
|
| Use Stored Procedure instead of FunctionMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|