Click here to Skip to main content
15,920,688 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,,


when i am inserting data into a table than that data which i have entered into
that table is copied into temp table


please give an idea
Posted

You mean if you have a table Employee, you want to copy those records from Employee to temptable #Employee?

Then try this.

if you are going to insert only once, then you can insert without declaring temptable.


SQL
select *  into #Employee from Employee


else

You can declare temptable and insert.

SQL
create table #Employee
([EMPID] int,
[EMPNAME] varchar(100)
)
insert into #Employee 
select * from Employee 
 
Share this answer
 
SQL
Insert into [temptablename] select *  from [yourtablename] where [condition]



Thanks
Ashish
 
Share this answer
 

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