TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
srinivas P
NA
168
193.5k
How to write storedprocedure for search?
Aug 28 2011 10:48 AM
I have one tabe Name Product
ApplicationId uniqueidentifier
ProductId int
ProductTypeId int
ProductCode nvarchar(100)
ProductName nvarchar(max)
ProductFor nvarchar(max)
summary nvarchar(max)
Price money
TaggedPrice money
Keyword nvarchar(max)
Active Bit
My requirement is i want to write single procedure for search based on productCode,ProductName,ProductFor.
I have written for one search based on Productname
create procedure search
@ApplicationId Uniqueidentifier,
@Search nvarchar(max)
@Active Bit
As
Begin
select @searchLike=CASE WHEN @Search <> '' THEN 'AND product.productName LIKE ''' +@Search+'%' '' ELSE '' END
EXEC ('SELECT ProductId,ProductName from Products where ApplicationId=''' @Application+''' AND Active=''' +@Active+''''+
@searchLike+' order by productid')
ENd
but i want to write for three Fields single proc.(Productname,ProductFor,ProductCode)
plz help me
Thanks inadvance
Reply
Answers (
1
)
Microsoft.ACE.OLEDB.12.0" for linked server "(null) error
how to show 10 days before day to currentdate?