Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create table valued function with no input parameters..

Status
Not open for further replies.

davism

MIS
Nov 9, 2002
140
US
All,

I keep running into an issue here and I'm not sure why.

But in a nut-shell...how do you/can you create a table-valued-function that has no input parameters?

The function I have compiles successfully but when I try to execute a select from it for instance, I get:

Parameters were not supplied for the function...

However, I know there were parameters supplied and that's because there are to be none.

Any information on this?

Please let me know and very much appreciated.
 
Here's an example:

Code:
Alter Function dbo.NoParameters()
Returns @tbl Table(StudentId Int, StudentName VarChar(200))
AS
Begin

	Insert Into @tbl(StudentId, StudentName)
	Select StudentId, StudentName From Student

	Return
End

And to run it:

Code:
Select * From dbo.NoParameters()

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top