karthik parcha

karthik parcha

  • NA
  • 153
  • 93.1k

Replace Function

Jan 27 2012 4:21 AM
Hi
In my application there is one gridview in that there is two textboxex and two buttons
1)AccountNumber is textbox one button is there to right of the textbox and business name is textbox to the right one button is there

 EG:AccountNumber:10509
Businessname:Anderson's "The Grocery Store"
when i enter account number and clicking the button its retreving the businessname in SP it goes to TYPE='AN'
when i enter businessname and clicking the button account number is not retriving in SP it goes to TYPE='BN'


ALTER PROCEDURE [dbo].[DBSP_SF_GetAccountsLikeAccNo]
                    @AccountNo VARCHAR(20),
                    @BusinessName VARCHAR(40),
                    @Type VARCHAR(2)
                AS
                BEGIN

                    IF @Type = 'AN'
                    BEGIN
                        SELECT AccountNo, BusinessName FROM CustomerDetails WITH (NOLOCK) WHERE AccountNo like @AccountNo + '%'
                    END
                    ELSE IF @Type = 'BN'
                    BEGIN
                        SELECT AccountNo, BusinessName FROM CustomerDetails WITH (NOLOCK) WHERE  BusinessName like  REPLACE(@BusinessName, '''', '''''') + '%'
            END
         
                END
 plz help me this is my SP how change the SP

Answers (1)