Advertisement

06.26.2008 at 09:25AM PDT, ID: 23518825
[x]
Attachment Details

Need some expert advice on how to combine/AND data using UNION

Asked by wally_davis in SQL Server 2005

Tags: SQL 2005, IE 7.0

I basically want to retrieve a Workstation name and the OU Name/Path whose Status = 'InActive'.
When I run my VB.NET Code, i.e. the Sql Data Reader, i.e. sdr.READ, it acknowledges the ComputerName Field but it does not see the OUName Field. Error is "IndexOutOfRangeException was caught. OUName".
So, it looks like I've written the Stored Procedure incorrectly below.

Relevant Table/Column names are as follows:
Devices.DeviceID (PK, BigInt, not null)
Devices.Status (varchar(20), not null)
Network.DeviceID (PK,FK, BigInt, not null)
Network.ComputerName (PK, Varchar(50), not null)
Network.OUID (FK, Small Int, not null)
OU.OUID (PK, Small Int, not null)
OU.OUName (varchar(MAX), not null)
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
SELECT N.ComputerName
 From Devices D INNER JOIN Network N ON D.DeviceID=N.DeviceID
 Where D.Status = @Status
 UNION 
 Select O.OUName
 From Network N INNER JOIN OU O ON N.OUID=O.OUID
 Where O.OUID like @Wkstn_OU Or O.OUID like @Wkstn_OU2 Or O.OUID like @Wkstn_OU3 Or O.OUID like @Wkstn_OU4 Or O.OUID like @Wkstn_OU5
 
Loading Advertisement...
 
[+][-]06.26.2008 at 09:28AM PDT, ID: 21876405

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 09:32AM PDT, ID: 21876444

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 09:37AM PDT, ID: 21876498

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 09:50AM PDT, ID: 21876632

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 09:52AM PDT, ID: 21876653

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 09:53AM PDT, ID: 21876657

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 10:01AM PDT, ID: 21876741

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.26.2008 at 10:14AM PDT, ID: 21876884

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 10:22AM PDT, ID: 21876969

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.26.2008 at 10:34AM PDT, ID: 21877088

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 10:45AM PDT, ID: 21877195

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: SQL Server 2005
Tags: SQL 2005, IE 7.0
Sign Up Now!
Solution Provided By: daddotnet
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.26.2008 at 11:01AM PDT, ID: 21877354

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 11:10AM PDT, ID: 21877418

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.26.2008 at 11:14AM PDT, ID: 21877464

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 11:20AM PDT, ID: 21877530

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.26.2008 at 11:30AM PDT, ID: 21877630

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628