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

Store procedures variable with LIKE statements not returning results 1

Status
Not open for further replies.

fredong

IS-IT--Management
Sep 19, 2001
332
US
I created the store procedures below and is not giving me any results with the parameter below
--tek_sp_rpt_billingsVendor 'ALL'

and if I run with the
Select * from tapvendor where vendid like '%'
it return results

any ideas. Thanks.

-----------------------------------------------
CREATE Proc tek_sp_rpt_billingsVendor

@Vendor char(12)
As

SET NOCOUNT ON

IF UPPER(@Vendor) ='ALL'
Begin
SET @Vendor ='%'
end

select * from tapvendor where vendid like @Vendor
go
-----------------------------------------------------
 
Thanks alot..it works. How come it will not take char in a store procedures.Is it because varchar will allow wild card and char will not wild card?
 
No, a char(12) will always be 12 character long space-padded when needed.

Your query actually looks like

select * from tapvendor where vendid like '% '


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top