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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Always getting empty set in stored procedure 2

Status
Not open for further replies.

sparkbyte

Technical User
Joined
Sep 20, 2002
Messages
879
Location
US
I cannot seem to figure out why this stored procedure alway returns an empty set.

Code:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go


-- =============================================
-- Author:		John F Fuhrman III
-- Create date: 05/03/2010
-- Description:	File Number Lookup
-- =============================================
ALTER PROCEDURE [dbo].[usp_FileNumberLookup] 
	-- Add the parameters for the stored procedure here
	@strFileNumber varchar
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
SELECT	Tracking_ID, EmployeeID, MachineName, BoxNumber, FileNumber, TrackingDate
FROM	dbo.tblTrackingTable
WHERE	(FileNumber LIKE @strFileNumber 
			AND	FileNumber Not Like '.box.end.')
END

But this query works

Code:
SELECT	Tracking_ID, EmployeeID, MachineName, BoxNumber, FileNumber, TrackingDate
FROM	dbo.tblTrackingTable
WHERE	(FileNumber LIKE 'A12345678' 
			AND	FileNumber Not Like '.box.end.')

Thanks

John Fuhrman
 
have you tried to put the actual size behind the varchar?

change "@strFileNumber varchar"
to "@strFileNumber as varchar(50)"

--------------------
Procrastinate Now!
 
Give you both a star.

Crowley16, I can't believe it was that simple!! Thanks.

George, Tanks again!! great blog.

Lesson learned!! Be specific.


Thanks

John Fuhrman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top