Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 No Results Returned.

Author  Topic 

davidshq
Posting Yak Master

119 Posts

Posted - 2005-10-01 : 17:26:55
Any ideas why the following code is returning no results?
ALTER PROCEDURE dbo.AllGames
(
@varUserName varchar(200),
@varSearchQ varchar(10),
@varSearchTerm varchar(500)
)
AS
If @varSearchQ = 'false'
BEGIN
select uID, gID, LastPlayedDate into #templastplayed from LastPlayed where uID LIKE @varUserName
select uID as uID2, gID as gID2, Popularity as Popularity2 into #temppopularity from GamePopularity where uID LIKE @varUserName
select * from Game G LEFT JOIN #templastplayed LP ON G.ID=LP.gID LEFT JOIN #temppopularity GP ON G.ID=GP.gID2 ORDER BY G.Type
END
Else
select * from Game G WHERE G.Title LIKE @varSearchTerm OR G.Description LIKE @varSearchTerm
/* SET NOCOUNT ON */
RETURN
David

- http://www.civilwarsearch.com/
- http://www.thehungersite.com/
- http://www.grid.org/

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-10-01 : 17:28:51
Uhhh, no!!!!

????

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-10-01 : 17:49:19
Ask the debugging officer.

LIKE 'x'
is vastly different from
LIKE '%x%'

but i guess you got that covered.
Go to Top of Page

davidshq
Posting Yak Master

119 Posts

Posted - 2005-10-01 : 17:57:39
Well, here is an interesting twist to throw in. I added
set @varSearchQ = 'false' right before If @varSearchQ='false' and I am still getting no result set. :-P Before I added the If..Else statement it returned many results...
David.

- http://www.civilwarsearch.com/
- http://www.thehungersite.com/
- http://www.grid.org/
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-10-01 : 18:05:31
I'm sure there is a logical explanation...
Go to Top of Page

davidshq
Posting Yak Master

119 Posts

Posted - 2005-10-01 : 18:06:02
Mmm...I am sure there is as well. But right now it is eluding me.

- http://www.civilwarsearch.com/
- http://www.thehungersite.com/
- http://www.grid.org/
Go to Top of Page
   

- Advertisement -