Solved

how to implement function on  my database

Posted on 2013-05-25
1
311 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

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
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…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

911 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now