473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

SQL Query Error

123 100+
When I run this query in my sql query prompt, it comes out with the correct results, but when I but it into the VBA prompt for my excel program, it doesn't display the correct results.

Any ideas?
Expand|Select|Wrap|Line Numbers
  1.  SELECT     dbo.Defects.DefectId, dbo.Defects.Name, dbo.WorkflowSteps.StepName, dbo.PriorityTypes.Name AS PriorityName, dbo.SeverityTypes.Name AS Severity,  dbo.Defects.BuildNumber, dbo.DefectCustomFields.Custom_86 AS TargetBuildNumber, dbo.Defects.BuildNumberOfFix,      CONVERT(varchar(20), dbo.Users.FirstName) + ' ' + CONVERT(varchar(20), dbo.Users.LastName) as Creator,  CONVERT(varchar(20), Users_1.FirstName) + ' ' + CONVERT(varchar(20), Users_1.LastName)    AS AssignedUser, dbo.Projects.Name AS ProjectName
  2.  
  3. FROM         dbo.Projects INNER JOIN
  4.  dbo.Defects ON dbo.Projects.ProjectId = dbo.Defects.ProjectId INNER JOIN 
  5.     dbo.Users ON dbo.Defects.CreatorId = dbo.Users.UserId INNER Join                 dbo.PriorityTypes ON dbo.Defects.PriorityTypeId = dbo.PriorityTypes.PriorityTypeId INNER JOIN 
  6.                   dbo.SeverityTypes ON dbo.Defects.SeverityTypeId = dbo.SeverityTypes.SeverityTypeId INNER JOIN
  7.                            dbo.StatusTypes ON dbo.Defects.StatusTypeId = dbo.StatusTypes.StatusTypeId INNER JOIN 
  8.                          dbo.WorkflowSteps ON dbo.Defects.WorkflowStepId = dbo.WorkflowSteps.WorkflowStepId INNER JOIN
  9.                          dbo.DefectCustomFields ON dbo.Defects.DefectId = dbo.DefectCustomFields.DefectId  LEFT OUTER JOIN
  10. dbo.Users AS Users_1 ON dbo.Defects.AssignedToId = Users_1.UserId
  11.  
  12. WHERE     (dbo.Defects.StatusTypeId IN (9, 10, 1, 11, 2, 3, 8)) AND (dbo.Projects.ProjectId IN (" + projIds + ")) AND(dbo.Defects.DefectId NOT IN  
  13.  
  14. (SELECT     dbo.defects.DefectId 
  15. FROM          dbo.Defects AS Defects_1 
  16.  WHERE      (dbo.defects.LastUpdatedDateTime < '" + DefectClosedFilterDate + "') AND (dbo.defects.StatusTypeId = 8) AND (Defects.ProjectId IN (" + projIds + ")))) 
  17.  
  18. ORDER BY dbo.WorkflowSteps.StepName, dbo.PriorityTypes.Name, dbo.Defects.DefectId DESC
  19.  
Jul 17 '07 #1
1 1005
Newbie19
123 100+
I figured the issue out, I didn't have my variables declared.
Jul 17 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Polar | last post by:
I am having troubles finding the parse error in this script. I've been checking for weeks. I am too new to the subject I guess. I am trying to show a readord and them have a form at the bottom...
10
by: johnnyboy10017 | last post by:
I am having a hell of a time with what I think is a very simple query: It won't actually insert a new record into the specified table, but returns no error, in fact it returns "1" (or true) that...
2
by: jaysonsch | last post by:
Hello! I am having some problems with a database query that I am trying to do. I am trying to develop a way to search a database for an entry and then edit the existing values. Upon submit, the...
3
by: Nick Truscott | last post by:
<? // scoreinput.php - input a match score when match selected from list ?> <html> <head> <basefont face="Verdana"> </head> <body>
2
by: Mattyboy | last post by:
Guys I have built a database with saved queries that runs fine in Access but when I call it from the web using ASP, an exception occurs. I have tried multiple ways of testing the databases with...
6
by: Martin Lacoste | last post by:
Ok, before I headbutt the computer... don't know why when I add criteria in a query, I get an 'invalid procedure call'. I also don't know why after searching the help in access, the various access...
4
by: Alan Lane | last post by:
Hello world: I'm including both code and examples of query output. I appologize if that makes this message longer than it should be. Anyway, I need to change the query below into a pivot table...
4
by: deko | last post by:
When using OutputTo with a query, the 'File name' window in the 'Output To' dialog gets populated with the name of the query by default. This makes the exported file self-describing if the query...
11
by: Arpan | last post by:
I have always been working with SQL Server 2005 for ASP.NET apps but due to some reasons, had to revert back to MS-Access 2000. When I try to insert/update a MS-Access DB table (MDB), ASP.NET...
9
by: Kelii | last post by:
I've been trying to get this piece to work for a few hours, but have given up. I hope someone out there can help, I think the issue is relatively straightforward, but being a novice, I'm stumped....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.