Solved

how to implement function on  my database

Posted on 2013-05-25
1
315 Views
Last Modified: 2013-05-25
hi, i have an select statment that i want to put an a user function that returns an table:

dbo.fngetpost(iduser parameter)

this function returns an one row table with some information of that user in particular,

select top 5 t1.* from tbuser as t1
    left outer joing dbo.fngetpost(iduser parameter)

i can't do this above, i want to get the each information for the specific user that is return on the function, how do i put this 2 together?
0
Comment
Question by:rafaelrgl
1 Comment
 
LVL 21

Accepted Solution

by:
Dale Burrell earned 500 total points
ID: 39196454
Here is how you create an inline table valued function, although if the logic is complex you may need a regular table valued function.

http://msdn.microsoft.com/en-us/library/aa175924(v=sql.80).aspx

http://msdn.microsoft.com/en-us/library/ms191165(v=sql.105).aspx

Then your query would be:

select top 5 t1.*, p.*
from tbuser t1
left outer join (select * from dbo.fngetpost(iduser)) p
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question