Solved

Create Stored Procedure from a table and add an extra column using join

Posted on 2014-02-05
9
1,116 Views
Last Modified: 2014-02-13
I have a table. I want to develop a report that requires an additional column in that table. The additional column comes from another table.
I am planning to create a stored procedure from that original table and then to add an extra column from the other table using join.
To be informed that the data is updated regularly so I cannot use SELECT INTO kind of query.
How can I do this?
Does any one have idea or better suggestion to accomplish this?
Thanks in advance.
0
Comment
Question by:fireblues
  • 4
  • 2
9 Comments
 
LVL 24

Expert Comment

by:chaau
Comment Utility
in SQL Server you can make stored procedures act like Select statements. These stored procedures can be used when building reports. All you need to do is to make the last statement of the stored procedure the SELECT statement you wish to be used as your report. Like this:
CREATE PROCEDURE uspGetAllEmployees
AS
    SET NOCOUNT ON;
    SELECT e.LastName, e.FirstName, h.Department
    FROM vEmployeeDepartmentHistory h INNER JOIN Employee e ON e.EmployeeID = h.EmployeeID;
GO

Open in new window

0
 
LVL 37

Accepted Solution

by:
ValentinoV earned 350 total points
Comment Utility
It appears you are new to using stored procs in combination with SSRS.  The following article should shed some light on how to achieve this and should also contain some other useful info: Reporting On Data From Stored Procedures (part 1)

Don't hesitate to ask additional questions if still in doubt about something.
0
 

Author Comment

by:fireblues
Comment Utility
Thanks for guiding me the way for the solution.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:fireblues
Comment Utility
I've requested that this question be closed as follows:

Accepted answer: 0 points for fireblues's comment #a39854353

for the following reason:

I solved it using different way.
0
 
LVL 37

Expert Comment

by:ValentinoV
Comment Utility
In comment #a39854353 you stated the following: "Thanks for guiding me the way for the solution."  That's a strong indication that the earlier posts have helped you to get to your solution, even if you "solved it using different way".  So those posts should get accepted as solution, not your own comment.  For that reason I'll object once more... (previous objection was because you closed with a C-grade without any further interaction with us, read through the links posted by Netminder to get an understanding why that's not a good idea)
0
 

Author Comment

by:fireblues
Comment Utility
Since, I am new to this portal, I didn't know about the grades A, B and C.
Now that I have read, I know what they mean.
My apologies.
Of course the link helped me to go in certain direction.
I'll definitely reward points for that. :)
0
 

Author Closing Comment

by:fireblues
Comment Utility
Thanks.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

772 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

10 Experts available now in Live!

Get 1:1 Help Now