Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All
I have a procedure where I m passing parameter from front end to update three table but it is not it is not updating.
SQL
BEGIN
               UPDATE CNMPNT  SET
               CUSTOMER_ALPHA=@ChangeAlphaPoiner
              WHERE
               CUSTOMER_ALPHA=@aplhaPointer AND
               ltrim(Rtrim(replace(CUSTOMER_ID,char(0),''))) IN (@CustomerIDs)
          (rtrim(replace('0045864',char(0),'')),replace('0046677',char(0),''))'0045864','0046677') (LTRIM(RTRIM(replace('0045864',char(0),''))),LTRIM(RTRIM(replace('0046677',char(0),''))))           (rtrim(replace('0045864',char(0),'')),replace('0046677',char(0),''))          (ltrim(rtrim(replace('0045864',char(0),''))))--,replace('0046677',char(0),'')))
            '%0045864' ='0046677'
               UPDATE CMAPNT  SET
               CUSTOMER_KEY=@ChangeAlphaPoiner
                              WHERE
               CUSTOMER_KEY=@aplhaPointer AND
               ltrim(Rtrim(replace(CUSTOMER_ID,char(0),''))) IN (@CustomerIDs)
            ('0045864','0046677') like '0062076'=@aplhaPointer
               UPDATE CUSMAS  SET
               ALPHA_POINTER=@ChangeAlphaPoiner
               WHERE
               ALPHA_POINTER=@aplhaPointer AND
               ltrim(Rtrim(replace(cust_id,char(0),''))) IN (@CustomerIDs)
               '%0045864%','0046677') ='0062076'
            END



Please help
Posted
Updated 7-Mar-11 23:47pm
v3

The snippet you provided seems unreadable to me at-least. But I can suggest another better way of doing the task you are trying to achieve. You can use triggers in your context. Using triggers, you can update the record to next tables if the record has been successfully updated in the current table.

For eg:

SQL
create trigger u_authors on authors for update
as
Insert into log_authors (au_id) select au_id from inserted
go


Hope this helps. :rose:

Anurag
 
Share this answer
 
Comments
thatraja 8-Mar-11 6:03am    
/*The snippet you provided seems unreadable to me at-least.*/
No, for me too
IndrajitDasgupat 8-Mar-11 6:03am    
Hi
If U don't mind can U give me little more details because I m new to this, so it will help me to go ahead
Thanks for help
@nuraGGupta@ 8-Mar-11 6:56am    
Man, you have got google for anything you need and will provide results faster too. For a concept I should tell you that triggers are automatically fired whenever any DML statement is applied on tables. So, "insert command" being a DML statement will fire the triggers for that particular table in which insertion is being made. For more details on how to write triggers, you can search "write triggers in SQL server". That will surely give you required help. Please accept the answer if you found it useful.
IndrajitDasgupat 8-Mar-11 9:20am    
Thanks for help I had done what u told
I commented the code that does not make any sense (actually will fail if run).
SQL
BEGIN
               UPDATE CNMPNT  SET
               CUSTOMER_ALPHA=@ChangeAlphaPoiner
              WHERE
               CUSTOMER_ALPHA=@aplhaPointer AND
               ltrim(Rtrim(replace(CUSTOMER_ID,char(0),''))) IN (@CustomerIDs)
/*        (rtrim(replace('0045864',char(0),'')),replace('0046677',char(0),''))'0045864','0046677') (LTRIM(RTRIM(replace('0045864',char(0),''))),LTRIM(RTRIM(replace('0046677',char(0),''))))           (rtrim(replace('0045864',char(0),'')),replace('0046677',char(0),''))          (ltrim(rtrim(replace('0045864',char(0),''))))--,replace('0046677',char(0),'')))
            '%0045864' ='0046677'
*/
               UPDATE CMAPNT  SET
               CUSTOMER_KEY=@ChangeAlphaPoiner
                              WHERE
               CUSTOMER_KEY=@aplhaPointer AND
               ltrim(Rtrim(replace(CUSTOMER_ID,char(0),''))) IN (@CustomerIDs)
/*
            ('0045864','0046677') like '0062076'=@aplhaPointer
*/
               UPDATE CUSMAS  SET
               ALPHA_POINTER=@ChangeAlphaPoiner
               WHERE
               ALPHA_POINTER=@aplhaPointer AND
               ltrim(Rtrim(replace(cust_id,char(0),''))) IN (@CustomerIDs)
/*
               '%0045864%','0046677') ='0062076'
*/
            END

Would this work for you?
 
Share this answer
 
Comments
IndrajitDasgupat 8-Mar-11 9:23am    
no this is not working for me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900