|
[x]
Posted via EE Mobile
|
|
| Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
|
|
|
|
|
[x]
The Solution Rating System
|
|
| With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating. - The Grade of the Solution
- The Zone Rank of the Expert Providing the Solution
- The Number of Author and Expert Comments
- The Number of Experts Contributing
- The Feedback of the Community
Your Input Matters Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site. If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
|
|
|
|
Asked by ascnd in SQL Server 2005
In MS Access you build queries upon queries. You can put in parameters so you can pass user or program input into the queries. This where my problem is, building Views upon other Views in SQL with parameters. I know that Views cannot have parameters so you should use Stored Procedures. I am used to building complex queries in Access but I am stuck in SQL. For example I have a list of Employees with Punch In and Out dates with times. So I wrote a stored procedure below. This returns the values I need for the next step. Now I need to take that data (Q1) and do something to it and get (Q2) and then I need to take (Q1) and outer join it to (Q2) and get (Q3). Then I need to take (Q3) and do something to that and get (Q4). This was very easy to do in Access. If I have to construct some long text based solution in a stored procedure I will go nuts. How can I get the initial data I need with parameters and then continue with Views so I can build upon each one?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
|
********** STORED PROCEDURE **********
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[uspTmDiff]
@DateFrom DateTime = Null,
@DateTo DateTime = Null
AS
BEGIN
SET NOCOUNT ON;
SELECT
dbo.TimeClock.*,
DATEPART(yyyy, Dt) * 10000 + DATEPART(mm, Dt) * 100 + DATEPART(dd, Dt) AS YrMnDy
FROM
dbo.TimeClock
WHERE
(
(Dt BETWEEN CONVERT(DATETIME, @DateFrom, 102) AND CONVERT(DATETIME, @DateTo, 102))
AND
(EventType=1 OR EventType=2)
)
ORDER BY EmpID, Dt
END
|
20091111-EE-VQP-89 / EE_QW_2_20070628