|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Today @ 8:24 AM
Points: 43,
Visits: 351
|
|
Hi,
I have a task it sounds simple and resonable but when i started working on it i am not able to complete it so i thought finaly i would get some help from here ..
My task is i have to create a stored proc where we pass a parameter which Retrives the data from a table(Table A) and Table A has 5 Coloumns and i have another table(Table B) which is the replica of the table (Table A) with 10 coloumns. So What i have to do is Retrive the data from Table A insert that Record in Table B along with extra parameteres passed for those extra 5 coloumns
Because Table A and Table B coloumns has only 5 matching coloumns the issue is how to insert data in Table B for those additional 5coloumns
so please give me a solution or any hints or Query's
Thanks
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, February 22, 2013 11:13 AM
Points: 69,
Visits: 183
|
|
not sure i completely understand u. here is the basic:
insert tableB (col1, col2, col3, col4, col5) SELECT col1, col2, col3, col4, col5 FROM tableA
but if u are passing 5 params to the SP and want to capture those (1) that sounds completely unnecessary as the data should tell u that but...
insert tableB (col1, col2, col3, col4, col5, col6, col7, col8, col9, col10) SELECT col1, col2, col3, col4, col5, @param1, @param2, @param3... FROM tableA WHERE col1 = @param1 And col2 = @param2 ....
|
|
|
|
|
SSC-Dedicated
           
Group: Administrators
Last Login: Today @ 8:32 AM
Points: 31,433,
Visits: 13,747
|
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Wednesday, December 12, 2012 8:44 PM
Points: 1,
Visits: 46
|
|
''This query take whole back up of table Select * into table1 from table
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 2:05 PM
Points: 2,013,
Visits: 1,566
|
|
deepuduvedi (12/28/2011) ''This query take whole back up of table Select * into table1 from table
Posted Monday, January 21, 2008 2:29 AM
~Dev~
|
|
|
|