Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Weird Problem, "1-" characters duplicate records

Status
Not open for further replies.

pedricd

Programmer
Joined
Jul 9, 2001
Messages
1
Location
US
I'm using a stored procedure to pull records out of a
database and populate an asp page by searching the DB for
key words. It works perfectly unless the title(varchar
255) of one of the records in the database contains the
string "1-" in it. ex: "Management 1-Managing Change" It,
instead of pulling one record out of the database, pulls 2
identical records out (there are NO duplicate records in
the DB) and displays them. This again only happens when a
1- is in the title of the record. This is very pecuiliar
to me. This occurs with SQL Server 7 sp2. If you have
any thoughts or solutions, please respond. Here's the proc
(I altered the code to work in query analyzer to debug):

Select * from vwResources,tProviders, ResourceFormatXref
Where vwResources.iProvider=tProviders.iProviderID
AND
ResourceFormatXref.ResourceID=vwResources.ResourceID
AND Active<>0
AND (vwResources.Title LIKE '%Management 1-
Managing Change%'
OR vwResources.origin
LIKE '%Management 1-Managing Change%'
OR
vwResources.Shortdescription LIKE '%Management 1-Managing
Change%'
OR vwResources.Description
LIKE '%Management 1-Managing Change%'
OR vwResources.Location
LIKE '%Management 1-Managing Change%'
OR vwResources.Components
LIKE '%Management 1-Managing Change%'
OR vwResources.Keywords
LIKE '%Management 1-Managing Change%'
OR vwResources.Audience
LIKE '%Management 1-Managing Change%')
AND vwResources.ResourceID NOT IN
(SELECT ResourceID
FROM ResourcesCompanyXref
WHERE CompanyID = 10)
ORDER BY Title

It also happens with this unaltered stored procedure.

SELECT *
FROM vwResources, tProviders, ResourceFormatXref
WHERE vwResources.iProvider =
tProviders.iProviderID AND
ResourceFormatXref.ResourceID =
vwResources.ResourceID AND
Active = - 1 AND vwResources.ResourceID IN
(SELECT ResourceID
FROM ResourceCategoryXref
WHERE CategoryID =@CategoryID) AND
vwResources.ResourceID NOT IN
(SELECT ResourceID
FROM ResourcesCompanyXref
WHERE CompanyID = @CompanyID)
ORDER BY Title


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top