Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 adding data to existing tabe

Author  Topic 

The1Ash10
Starting Member

15 Posts

Posted - 2009-03-21 : 12:48:27
I trying to update a table with new data from another table. I don't want to remove the data that is already there, but just simply add to it. The following is the code that I'm currently using:


select *

into HypEvlog_2009.dbo.HypEvLog_2009_03
from HypEvLog_Main.HE_EvLog.UP_20080611220416
where sql_time <= getdate() - 3;
go


I'm sure this is something simple, but I keep getting the message "there is already an object named 'TABLE NAME' in the database.

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2009-03-21 : 13:01:56
You should use an INSERT statement, instead of a SELECT INTO statement.

You can lookup the syntax of SQL statements in SQL Server 2005 Books Online
http://msdn2.microsoft.com/en-us/library/ms130214.aspx


If you are new to SQL, there is free online training available here on these links
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp




CODO ERGO SUM
Go to Top of Page

The1Ash10
Starting Member

15 Posts

Posted - 2009-03-21 : 13:15:59
Thanks! That helps a great deal.
Go to Top of Page
   

- Advertisement -