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 |
|
thiyait
Yak Posting Veteran
70 Posts |
Posted - 2005-10-17 : 02:59:11
|
| I need to get the table name from the user defined function for the query.how do i build the queryHere is my procedure and function.create procedure dbo.GetVendors@controlID intasselect * from <Dynamic tablename>--here i need to get dynamically from the functionGOFunction:CREATE FUNCTION dbo.GetTable(@controlID integer)RETURNS varchar(25) AS BEGIN Declare @return varchar(25)select @return=Table_Used from profile_collection Where controlID=@controlIDreturn @returnENDThanks in advance |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-10-17 : 03:10:25
|
| Are you talking about somthing like this .. create procedure dbo.GetVendors@controlID intasExec('select * from ' + Dbo.GetTable(@ContolID))GOComplicated things can be done by simple thinking |
 |
|
|
|
|
|