UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Append / Select Insert, SQL Server 2012    
 
   
Everettc4
post Dec 10 2019, 09:35 PM
Post#1



Posts: 212
Joined: 12-June 06
From: Oregon


Trying to append/ select into. I'm trying to move 1.6 million timecard punches to a new table. I'm new to this obviously but what's the trick? I'm trying to compile these entries and get a new SQLtimerecordID from the new table. In the past, using access I would just append all fields to the new table except the ID field and that would do it. Heres how the tables built if it helps, The Name of the New Table will be Timeclock1. Thanks for the help!! Cheers

[SQLTimerecordID]
,[EmpID]
,[Date]
,[BadgeNum]
,[JobNum]
,[TikNum]
,[TrackingNum]
,[StartDate]
,[StartTime]
,[EndDate]
,[EndTime]
,[MachineID]
,[StartQuantity]
,[EndQuantity]
,[Quantity]
,[Note]
,[CodeID]
,[Paid]
,[CheckNum]
,[RateID]
,[StartDate_2]
,[StartTime_2]
,[EndDate_2]
,[EndTime_2]
,[Hrs_str]
,[Hrs_ot]
,[Hrs_dbl]
,[Hrs_Sick]
,[Hrs_hld]
,[Hrs_Vac]
,[Hrs_Total]
,[TimerecordID]
,[Rate_SQL_TC]
,[SiteID]
,[TCapTS]
Go to the top of the page
 
MadPiet
post Dec 10 2019, 11:13 PM
Post#2



Posts: 3,574
Joined: 27-February 09



INSERT INTO DestinationTable (column1, column2,....)
SELECT ThisColumn, ThatColumn
FROM MyTable
WHERE...
Go to the top of the page
 
Everettc4
post Dec 11 2019, 11:09 AM
Post#3



Posts: 212
Joined: 12-June 06
From: Oregon


Thank you here's what ended up working
INSERT INTO Employees4 (
[DepartmentID]
,[Primary_Positions_ID]
,[E_typeID]
,[Shift_ID]
,[Employee]
,[Dept]
,[Emp_Type]
,[Agency]
,[Last_INT]
,[Primary_Position]
,[Date_Hired]
,[Dept_Rank]
,[ManagerID]
,[Active]
,[PayrollID]
,[EmpPic])
SELECT [DepartmentID]
,[Primary_Positions_ID]
,[E_typeID]
,[Shift_ID]
,[Employee]
,[Dept]
,[Emp_Type]
,[Agency]
,[Last_INT]
,[Primary_Position]
,[Date_Hired]
,[Dept_Rank]
,[ManagerID]
,[Active]
,[PayrollID]
,[EmpPic] FROM Employees
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    5th April 2020 - 06:28 PM