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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 QL

Author  Topic 

ayoola
Starting Member

3 Posts

Posted - 2005-06-05 : 12:39:31
Please help guys,

I have a UDF that returns 3 columns of data in a table - uid, fname, lname.

i originally had this logic in a stored procedure, but as the need to return this info grew, I decided to put if into a stored procedure.

The T-SQL logic itself just performs a series of joins on multiple tables and insert the final result into variable table, a final select statement returns the content of this variable table - i.e, the uid's, fnames and lnames it contains.

I encased the entire logic in a UDF just so I can do stuff like

select * from users where uid in (select uid from dbo.myudf)

this works when the result from the udf is less than 8.

if the returned table conatins more than 8 rows, the procedure keeps running indefinitely.

This same T-SQL logic works from a stored procedure without any issues

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-06-05 : 14:44:29
>> if the returned table conatins more than 8 rows, the procedure keeps running indefinitely.

How do You know that it contains more than 8 rows if it runs indefinitely ?


There is probably something wrong with Your logic somewhere in the code. Any loops, that never finish ?
Post the DDL of the function.

rockmoose
Go to Top of Page

ayoola
Starting Member

3 Posts

Posted - 2005-06-05 : 18:02:32
I know it should return more than 8 rows because, I tested the original stored procedure, that's the core of the function with the same parameters
Go to Top of Page

ayoola
Starting Member

3 Posts

Posted - 2005-06-05 : 18:06:42
quote:
Originally posted by rockmoose

>> if the returned table conatins more than 8 rows, the procedure keeps running indefinitely.

How do You know that it contains more than 8 rows if it runs indefinitely ?


There is probably something wrong with Your logic somewhere in the code. Any loops, that never finish ?
Post the DDL of the function.


rockmoose




The parameters I pass to the function determine the number of rows it returns.

Remember, this is a working stored procedure, that works perfectly fine, I encased the logic in a multi-statement UDF so I can access the resultset in select statements etc.

Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-06-05 : 18:09:00
You can give us more information.

(DDL of sp + function)

rockmoose
Go to Top of Page
   

- Advertisement -