SQL - INSERT INTO / SELECT FROM, one field with SET value (1 Viewer)

ironfelix717

Registered User.
Local time
Yesterday, 19:18
Joined
Sep 20, 2019
Messages
92
Hi,

Is it possible to provide a SET value in an INSERT/SELECT-FROM query??

EX:
Code:
       SQL = "INSERT INTO ToolingBuilds " & _
      "SELECT ToolID, ToolVersion, ToolCompID, ToolCompVersion, " & _
      "DateModified FROM TempTable;"

In the above, I need to insert all the fields from 'TempTable', but instead of inserting one the fields (say, Tool Version), I need to set the value instead.

Thanks
 

plog

Banishment Pending
Local time
Yesterday, 18:18
Joined
May 11, 2011
Messages
10,138
Most likely in the SELECT do this:

SELECT ToolID, "MyValue" AS ToolVersion, ToolCompID ...
 

ironfelix717

Registered User.
Local time
Yesterday, 19:18
Joined
Sep 20, 2019
Messages
92
Hi,

I get an error when using that.

"Query input must contain at least one table or query"
 

plog

Banishment Pending
Local time
Yesterday, 18:18
Joined
May 11, 2011
Messages
10,138
What is your exact SQL?
 

Users who are viewing this thread

Top Bottom