| Author |
Topic |
|
kathyc2003
Starting Member
15 Posts |
Posted - 2006-10-24 : 13:48:03
|
| Hello, I have written the procedure shown below and I prompt the user for a start date/time and end date/time. Format is:12/06/2006 1:51:32 AMMy query does not give me the correct results - what have I done wrong?(my sample code)CREATE PROCEDURE [dbo].[CaseProcedure](@StartDate DATETIME, @EndDate DATETIME) AS SELECT I.CFScompanyname, E.CreatedOn, E.TicketNumber, E.OwningUser, U.FirstName, U.LastNameFROM IncidentExtensionBase I INNER JOIN IncidentBase E ON I.IncidentId = E.IncidentId INNER JOIN SystemUserBase U ON E.OwningUser = U.SystemUserIdWHERE E.createdon >= @StartDate) AND E.createdon <= @EndDateORDER BY E.CreatedOn DESC;GO |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-10-24 : 13:50:38
|
quote: My query does not give me the correct results - what have I done wrong?
I have no idea - you didn't say what the correct results should be or what incorrect results you're getting. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-10-24 : 14:17:30
|
This is your query, formatted for easier readingSELECT I.CFScompanyname, E.CreatedOn, E.TicketNumber, E.OwningUser, U.FirstName, U.LastNameFROM IncidentExtensionBase I INNER JOIN IncidentBase E ON I.IncidentId = E.IncidentId INNER JOIN SystemUserBase U ON E.OwningUser = U.SystemUserIdWHERE E.createdon >= @StartDate) AND E.createdon <= @EndDateORDER BY E.CreatedOn DESC I'll give you a hint. It has to do with a missing paranthesis to do...Peter LarssonHelsingborg, Sweden |
 |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2006-10-24 : 15:51:20
|
| I was not going to comment this topic, but...Now I really do understand why they call you the "Patron Saint" !!!________Karmarockmoose |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-10-24 : 23:03:19
|
| If paranthesis is missing then the questioner should have got error than wrong results?MadhivananFailing to plan is Planning to fail |
 |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2006-10-24 : 23:31:19
|
maybe what they mean by "wrong results" is this: Incorrect syntax near ')'. SqlSpec - a fast, cheap, and comprehensive data dictionary generator for SQL Server 2000 and 2005 - http://www.elsasoft.org |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-10-25 : 06:44:31
|
quote: Originally posted by jezemine maybe what they mean by "wrong results" is this: Incorrect syntax near ')'. SqlSpec - a fast, cheap, and comprehensive data dictionary generator for SQL Server 2000 and 2005 - http://www.elsasoft.org
Yes. It is not wrong result but Error MadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-10-25 : 07:31:10
|
| Or the poster omitted every fourth and/or third row from query in case we accidentally could figure out what was happening?Peter LarssonHelsingborg, Sweden |
 |
|
|
|