Advertisement

06.26.2008 at 01:15PM PDT, ID: 23519748
[x]
Attachment Details

I want to perform a search values in the DB NOT LIKE @Var

Asked by wally_davis in SQL Server 2005, Databases Miscellaneous, MS SQL Server

Tags: SQL 2005, IE 7.0

I have (5) values in my OU Table, where OU.OUID = 1, 2, 3, 4 or 5.
i.e.
1 = (OU=Desktops,OU=Prod,DC=Business,DC=Com)
2 = (OU=Laptops,OU=Prod,DC=Business,DC=Com)
3 = (OU=Desktops,OU=Dev,DC=Business,DC=Com)
4 = (OU=Laptops,OU=Dev,DC=Business,DC=Com)
5 = (OU=Prod,OU=Printers,DC=Business,DC=Com)
I want to exclude these OU's from the search. I've tried both the <> and NOT LIKE comparison operators and yet, it still returns the only 3 Workstations I have in my DB, which I would expect none of them to be returned.
Many thanks for supported provided,
WDStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
 
ALTER PROCEDURE [dbo].[GetWkstnsInNonSupportedOUs]
 
@Wkstn_OU smallint,
@Wkstn_OU2 smallint,
@Wkstn_OU3 smallint,
@Wkstn_OU4 smallint,
@Wkstn_OU5 smallint
	
AS
BEGIN
 
SELECT N.ComputerName, O.OUName
FROM Devices D INNER JOIN Network N ON D.DeviceID=N.DeviceID
INNER JOIN OU O ON N.OUID=O.OUID
WHERE O.OUID <> @Wkstn_OU Or O.OUID <> @Wkstn_OU2 Or O.OUID <> @Wkstn_OU3 Or O.OUID <> @Wkstn_OU4 Or O.OUID <> @Wkstn_OU5
 
END
[+][-]06.26.2008 at 01:17PM PDT, ID: 21878612

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

Zones: SQL Server 2005, Databases Miscellaneous, MS SQL Server
Tags: SQL 2005, IE 7.0
Sign Up Now!
Solution Provided By: matthewspatrick
Participating Experts: 3
Solution Grade: A
 
 
[+][-]06.26.2008 at 01:19PM PDT, ID: 21878625

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 01:20PM PDT, ID: 21878634

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 01:21PM PDT, ID: 21878640

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