Hi
I want to know how to write storedprocedure when search creiteria is Present.

Here the query to give the list of

"select ID, Salesmennummer , Salesname Commision, Areacode from sales_master

Areacode Salesmennummer Salesname Commision
1 1000 Rams 200
2 2000 Johny 1000


I Want to search above list by areacode or Salesmennummer or Salesname.

so PlZ help me how to write storedprocedure for this.

Thanq.

You could try to use a case statement in the where clause to determine which value to match. You could pass two parameters to the stored procedure. One of the parameters could be used to determine which field from the database to use in the where clause (this is also what would be in the case statement). The other parameter would be the value you want to match.

Very good bcasp :) they answer the question. You need to read in where clause SELECT column1, column2, .... FROM TABLE WHERE column4 = @value1 AND column5 = @value2

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.