Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
vemulavijay
Starting Member
32 Posts |
Posted - 2009-06-03 : 09:11:06
|
Hi,I am creating a stored procedure for searching table DealTable. This table contains columns: Customer, DealID, DealCreatedDate, DealDescription, DealVersionID, OpportunityID.The user can enter any information to search DealTable in my UI. some input parameters can be null.I am unable to create a stored procedure to implement this search feature.Please note that all information is present in only one table. I have to just search the DealTable.Pls help if somebody has logic for this. Thanks in Advance.My Stored Procedure:CREATE PROCEDURE DBO.SEARCH_DEAL(@Customer VARCHAR,@Deal_ID INT,@DEAL_CREATED_DATE DATETIME,@DEAL_DESCRIPTION VARCHAR,@DEAL_VERSION_ID INT@OPPORTUNITY_ID INT,) AS BEGIN |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-06-03 : 09:17:05
|
Do like thisCREATE PROCEDURE DBO.SEARCH_DEAL(@Customer VARCHAR,@Deal_ID INT,@DEAL_CREATED_DATE DATETIME,@DEAL_DESCRIPTION VARCHAR,@DEAL_VERSION_ID INT@OPPORTUNITY_ID INT,) AS BEGINSelect columns from yourtablewhere(Customer=@Customer or @Customer is null)and(Deal_ID=@Deal_ID or @Deal_ID is null)..MadhivananFailing to plan is Planning to fail |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
|
vemulavijay
Starting Member
32 Posts |
Posted - 2009-06-04 : 00:56:28
|
Thanks for the suggestion. i will try and get back. |
|
|
vemulavijay
Starting Member
32 Posts |
Posted - 2009-06-04 : 02:15:43
|
This works Great.Thanks madhivanan and webfred |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-06-04 : 02:40:13
|
quote: Originally posted by vemulavijay This works Great.Thanks madhivanan and webfred
You are welcome MadhivananFailing to plan is Planning to fail |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-06-04 : 02:41:14
|
quote: Originally posted by vemulavijay This works Great.Thanks madhivanan and webfred
You are welcome MadhivananFailing to plan is Planning to fail |
|
|
|
|
|
|
|