October 15, 2009 at 12:14 am
How do I copy datas from Table A into TempTableB (exactly same data)?
I tried the select and insert into statement, it moved all my datas in Table A over, which I don't want to.
Thanks.
October 15, 2009 at 1:18 am
Requirement is not clear as such.. but is this what you are looking for?
SELECT <Your coulmns....n>
INTO #tableB
FROM TableA
---------------------------------------------------------------------------------
October 15, 2009 at 1:33 am
i want to copy (duplicate) the data in col (A, B, C) into TempTable. But previously when I wrote the SQL statement Select a,b,c Into #temptable, it shifted all the data over and I can't find the temptable.. 😡
October 15, 2009 at 1:41 am
Is it possible to paste your query here please?
---------------------------------------------------------------------------------
October 15, 2009 at 2:52 am
select col1,col2,col3 into #TableB
from TableA
group by col1,col2,col3
having count(*)> 1
select * from #TableB
now the #TableB table having the duplicate data of the TableA
October 15, 2009 at 7:51 pm
sorry I'm still confused..
Do I write this in a 'new query'?
Where will the #tableB appear in?
Thanks.
October 15, 2009 at 9:54 pm
Table #tableB is a temp table, it will only exist for the length of your connection or until you drop it, whichever comes first. You must refer to it as #tableB. Whether it is a new query is dependent on what you are doing.
Judging by the questions you might want to spend some time reading Books Online for SQL Server.
CEWII
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply