I am getting the following error message:
Column names in each table must be unique. Column name 'ColumnName' in table '#tmpTbl' is specified more than once.
I know it has to do with the **join **and yes, I know I can also declare a table with all the parameters but there are 30 separate tables I need to do this with and that's time consuming.
Here's the script:
SELECT * INTO #tmpTbl
FROM Archive.dbo.ShipTo i
INNER JOIN Archive.dbo.Order o ON o.ShipToID = i.ShipToID
WHERE o.OrderID = 15051
ALTER TABLE #tmpTbl
DROP COLUMN ArchiveDate
select * from #tmpTbl
I've tried a few things and searched around for a solution but just can't find one.
And like I mentioned, creating a table like DECLARE @tmp TABLE (Col1 INT, ...) would be time consuming.
Thanks for any input.