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 2000 Forums
 SQL Server Development (2000)
 Inserting From Query into Existing Table???

Author  Topic 

Warpig
Starting Member

1 Post

Posted - 2005-01-06 : 09:35:31
This code works fine in the query analyser but gives different results when you actualy return all rows from the table. Please help.


CREATE PROCEDURE MassInsert
AS
TRUNCATE Table Results
INSERT INTO Results (EXPR1,ECNID )
SELECT ECNID, MAX(UniqueID) AS EXPR1
FROM dbo.ECN
GROUP BY ECNID
GO

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-01-06 : 09:52:34
change the order of columns in a select:

INSERT INTO Results (EXPR1,ECNID )
SELECT MAX(UniqueID) AS EXPR1, ECNID
FROM dbo.ECN
GROUP BY ECNID

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -