Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a table named A.I need to insert values into table A and also
i need to insert one column of another table into table A.can you help me..
Posted
Updated 6-Dec-12 17:57pm
v2
Comments
choudhary.sumit 6-Dec-12 23:50pm    
http://www.codeproject.com/Articles/38682/Overview-of-SQL-Server-Stored-Procedure
Patel Shailendra 7-Dec-12 0:05am    
how many columns you have in table
renjimaramanan mr 7-Dec-12 0:09am    
in A table 8 columns
Patel Shailendra 7-Dec-12 1:17am    
if there not having any auto generated column then pass 8 parameter with same data type as in table.

and if there any auto generated column then pass that column less parameter
eg
1 auto generated column then pass 7 parameter in store procedure

 
Share this answer
 
see this example...
SQL
insert into tableA 
select @col1,@col2...,@col8,(select top 1 col1 from tableB) as col9

underline line is for fetch value from other table's column

Happy Coding!
:)
 
Share this answer
 
Comments
renjimaramanan mr 7-Dec-12 0:50am    
thank u so much.... :)
Aarti Meswania 7-Dec-12 0:54am    
welcome :)
glad to help you! :)

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