soozh
asked on
TSQL - functions..
Hej,
SQL Server 2008.
Can a function be declared in a stored procedure?
I just want to simplfiy the code and make it more readable.
Thanks
SQL Server 2008.
Can a function be declared in a stored procedure?
I just want to simplfiy the code and make it more readable.
Thanks
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
For the record : declaring a function in dynamic sql and using it in dynamic sql does not make your code more readable.
We don't have a clue on what that function has to do so we can't suggest on how to do it another way.
For example
I think #tables or table variables is a way to deal with 'variable circomstances' in a process when it comes to which list of values applie on this moment.
We don't have a clue on what that function has to do so we can't suggest on how to do it another way.
For example
I think #tables or table variables is a way to deal with 'variable circomstances' in a process when it comes to which list of values applie on this moment.
Actually, if you look more closely, you'll see that I was careful enough to say *RE*create a function. The function would need to already exist, at least as a shell, but could then be replaced by code generated dynamically.
Yes, you would need to do your own serialization in that case, but that's not terribly difficult, viz sp_getapplock & sp_releaseapplock.
Yes, you would need to do your own serialization in that case, but that's not terribly difficult, viz sp_getapplock & sp_releaseapplock.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER