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 |
|
psfaro
Starting Member
49 Posts |
Posted - 2010-05-20 : 14:30:55
|
| Hi How can this be workI need to return a value(with a function) from a table , but the name of the table is dynamic .when i run the code i got the messageOnly functions and some extended stored procedures can be executed from within a function. ALTER FUNCTION [dbo].[RetCFin] ( @ano varchar(20) )RETURNS varchar(20)ASBEGIN DECLARE @conta_fin varchar(300) declare @cmd varchar(300) declare @tab varchar(20) -- set @tab='cctpoc'+@ano set @conta_fin= 'select cfin_pa FROM [' + @tab +']' EXEC sp_executesql @conta_fin RETURN @conta_finENDRegards. Pedro Faro |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|