sql - How to Update last 3 columns of a temp table -


reqid             respid         name            part   type   base ---------------------------------------------------------------------------- 674508621df6    d5830288f5c2    00000233a   null    null    null c356c1e03784    d5830288f5c2    00000233a   null    null    null 

when running following query out stored procedure part getting above result. want update sp using return values sp.

declare @temptable table( reqid varchar(255), respid  varchar(255), name varchar(255), part bit, type bit, base bit)  insert  @temptable (reqid ,respid  ,name) select * distributessystemsview dsv join mydomain md with(nolock) on md.mydomainid = dsv.mydomainid dsv.lotoperationsegmentresponseid=@lotopsegrespid 

stored procedure part
should able update part,type , base columns using following sp takes md.domainid parameter above join statement

 insert  @temptable(part,type,base)  execute [soadb].[dbo].[splocal_anotherspl] md.mydomainid   select * @temptable 

if understand problem correctly, can try this.

  1. add new column mydomainid @temptable
  2. insert data @temptable before
  3. have table @temptable2 stores data procedure specific @mydomainid
  4. run update of @temptable after joining @temptable2
  5. rinse , repeat steps 3 , 4 if required different values of @mydomainid

query

declare @temptable table( mydomainid  varchar(255), reqid varchar(255), respid  varchar(255), name varchar(255), part bit, type bit, base bit);  insert  @temptable (mydomainid,reqid ,respid  ,name) select dsv.mydomainid,reqid ,respid  ,name distributessystemsview dsv join mydomain md with(nolock) on md.mydomainid = dsv.mydomainid dsv.lotoperationsegmentresponseid=@lotopsegrespid    declare @temptable2 table( part bit, type bit, base bit)  insert  @temptable(part,type,base) execute [soadb].[dbo].[splocal_anotherspl] @mydomainid  update t set part = temp2.part , type = temp2.type, base = temp2.base @temptable t cross join @temptable2 temp2 t.mydomainid = @mydomainid 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -