January 20, 2008 at 1:59 pm
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
January 20, 2008 at 3:00 pm
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
....
January 20, 2008 at 3:38 pm
This sounds like a homework assignment. Please make your own attempt at this and show some effort.
December 28, 2011 at 5:53 am
''This query take whole back up of table
Select * into table1 from table
December 28, 2011 at 6:45 am
deepuduvedi (12/28/2011)
''This query take whole back up of tableSelect * into table1 from table
:w00t: Posted Monday, January 21, 2008 2:29 AM
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply