Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Brain dead - SQL syntax
Message
From
09/09/2007 06:12:22
 
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01253096
Message ID:
01253278
Views:
21
W O W !!! Thanks Sergey. I will be testing these techniques today. I truely appreciate all your efforts and the extensive detail to your solutions.

Glenn

>>Was my answer clear? I get two lists of qualifiers one list is required qualifiers and the other is excluded qualifiers. The selected records must have all required qualifiers and none of the exluded qualifiers.
>>
>One more. It uses my ufn_Alines from http://www.berezniker.com/display/SQL/Alines+UDF+-+String+Split
>
>CREATE PROCEDURE GetContactsByQualities4
>	@Inc varchar(100),
>	@Exc varchar(100)
>AS
>
>DECLARE @Qids TABLE (QID int, Qtype int)
>
>INSERT INTO @Qids
>	SELECT CAST(Item AS int), +1 FROM dbo.ufn_Alines(@Inc, ',')
>INSERT INTO @Qids
>	SELECT CAST(Item AS int), -1 FROM dbo.ufn_Alines(@Exc, ',')
>
>
>SELECT * FROM Contacts c
>	WHERE (SELECT COUNT(*) FROM @Qids WHERE Qtype > 0) =
>		(SELECT SUM(Qtype) FROM @Qids JOIN ContactQualities
>				ON QID =  ContactQualities.qualifierid
>				WHERE ContactQualities.contactid = c.id)
>
>RETURN 0
>
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform