Laziale
Laziale

Reputation: 8225

Insert into select from SQL query with both query and static values

I am trying to perform insert query from one specific column from a table plus two static values, I am trying something like this:

INSERT INTO TableA(PolicyId, Type, Used)
SELECT ID FROM Policies, 'A', 1 

But I am getting error near 'A' per SSMSE. How can I tackle this task?

Upvotes: 3

Views: 3640

Answers (1)

Mike Christensen
Mike Christensen

Reputation: 91608

You'll need to put these static values in your SELECT clause:

INSERT INTO TableA(PolicyId, Type, Used) SELECT ID, 'A', 1 FROM Policies

Upvotes: 7

Related Questions