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
 General SQL Server Forums
 New to SQL Server Programming
 How to use dynamic sql in the function

Author  Topic 

mavershang
Posting Yak Master

111 Posts

Posted - 2009-12-11 : 19:13:52
Hi there. I need to transfer a table name to a function and do some calculation. But it is not allowed to do run a dynamic sql within the function. Any one has any idea to walk around that? Thanks.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-12-11 : 19:20:40
Is it a fix number of different tables?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

mavershang
Posting Yak Master

111 Posts

Posted - 2009-12-11 : 19:24:05
I just need to transfer one table, so it is fixed.
Thanks

quote:
Originally posted by webfred

Is it a fix number of different tables?


No, you're never too old to Yak'n'Roll if you're too young to die.

Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-12-11 : 19:32:39
That is not what I mean.
I you want to give a table name to the function then it will be only one at a time - sure!
But it will not be always the same table name because then you could code it fix in the function.
So how many different tables are playing in this game?
My idea was to code the calculation many times with different table names...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-12-12 : 01:15:29
whats the need of passing tablename as a parameter to function? why does object change dynamically?
Go to Top of Page

BlaiN
Starting Member

7 Posts

Posted - 2009-12-12 : 03:23:57
you have to use a stored srocedure to handle that.
Go to Top of Page
   

- Advertisement -