View Single Post
  #6 (permalink)  
Old May 28th, 2007, 02:53 AM
happygv happygv is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

jurio,

So how is that you differentiate between Wildcard and Non-Wildcard values that are passed as parameters?

I think you should play with or without LIKE operator for getting around this.
Code:
-- checking for actual value of the parameter passed.
SELECT * FROM TABLE_NAME 
    WHERE ColName = @Parameter
-- IF the above query return rows then dont proceed to next query, 
else proceed further to get the pattern matching results

-- checking for PATTERN match of the parameter passed.
SELECT * FROM TABLE_NAME 
    WHERE ColName LIKE '%' + @Parameter + '%' OR ColName IS NULL


Cheers

_________________________
- Vijay G
Strive for Perfection