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

LIKE stored procedure conundrum

Status
Not open for further replies.

oddball

Technical User
Mar 17, 2000
64
GB
When i pass the following stored procedure the variable @LetterRange with values:

a-e

or

abcde

why do i only receive back company names begining with 'a'?

===========================================================

ALTER PROCEDURE GetAlphabeticalCompanies
(
@LetterRange VarChar
)
AS

SELECT
CompanyID,
CompanyName

FROM
Company

WHERE
CompanyName LIKE '[' + @LetterRange + ']%'

ORDER BY
CompanyName

===========================================================

cheers,

si
 
Fixed it!

should have put:

@LetterRange nvarchar(3)

when sending a-e, doh!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top