October 7, 2010 at 4:38 am
nadersam (10/7/2010)
can u pls tell me whats wrong in this syntax, i am trying to use table valued functions insteadThanks
Create function [GetTableData] (@TableName varchar(50),@RowID integer)
returns table
AS
Declare @MySQL varchar(100);
Set @Mysql= 'select * from ' + @TableName + ' where id = ' + @RowID
exec (@Mysql)
return
As suggested in last post table valued function are not allowed in sql 2005
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
October 7, 2010 at 5:06 am
nadersam (10/7/2010)
can u pls tell me whats wrong in this syntax, i am trying to use table valued functions insteadThanks
Create function [GetTableData] (@TableName varchar(50),@RowID integer)
returns table
AS
Declare @MySQL varchar(100);
Set @Mysql= 'select * from ' + @TableName + ' where id = ' + @RowID
exec (@Mysql)
return
The RETURNS clause is missing the definition of the output table. See here.
Also, EXEC can only be used within a function to call an extended stored procedure.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
October 7, 2010 at 5:14 am
Thank you all guys, appreciate your help.
Regards
Nader
Viewing 3 posts - 31 through 32 (of 32 total)
You must be logged in to reply to this topic. Login to reply