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 |  
                                    | jayram11Yak Posting Veteran
 
 
                                        97 Posts | 
                                            
                                            |  Posted - 2010-10-21 : 11:58:32 
 |  
                                            | Hii get an error for the following sproc. Any help in rectifying thisUpdate Bset B.ASC_CHANGES = 2 from ASCG as Ainner join (select * from ASCG where asc_Eff_Start = '04/01/2008') as Bon A.ASC_HCPCS = B.ASC_HCPCSwhere A.asc_Eff_Start = '01/01/2008'and a.asc_base <> b.ASC_BASEand B.ASC_CHANGES is nulland b.asc_link is nullcreate procedure sp_ASCratechange@date1 varchar(10),@date2 varchar(10)asUpdate Bset B.ASC_CHANGES = 2 from ASCG as Ainner join (select * from ASCG where asc_Eff_Start = @date2) as Bon A.ASC_HCPCS = B.ASC_HCPCSwhere A.asc_Eff_Start = @date1and a.asc_base <> b.ASC_BASEand B.ASC_CHANGES is nulland b.asc_link is nullexecute sp_ASCratechange '01/01/2008', '04/01/2008'Msg 4421, Level 16, State 1, Procedure sp_ASCratechange, Line 5Derived table 'B' is not updatable because a column of the derived table is derived or constant. |  |  
                                    | visakh16Very Important crosS Applying yaK Herder
 
 
                                    52326 Posts | 
                                        
                                          |  Posted - 2010-10-23 : 02:53:10 
 |  
                                          | you've a derived or constant column in ASCG so use only required columns in select rather than *i.e Update Bset B.ASC_CHANGES = 2 from ASCG as Ainner join (select ASC_HCPCS,ASC_BASE,ASC_CHANGES,asc_link from ASCG where asc_Eff_Start = '04/01/2008') as Bon A.ASC_HCPCS = B.ASC_HCPCSwhere A.asc_Eff_Start = '01/01/2008'and a.asc_base <> b.ASC_BASEand B.ASC_CHANGES is nulland b.asc_link is null------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |  
                                          |  |  |  
                                |  |  |  |