Reputation: 1196
first of all... Before someone comes here and tag it as "duplicated question" please take a better look to my question !
I have an Insert that I was using Parameters
to pass the values but only
one field I need to take it's value with a select, look:
INSERT INTO chamados (club, project, function, description, priority) (@club, @proj, @func, @description, @pri)";
Only the club
field I need to get from a SELECT query. How Do I do that?
Obs: It's not a duplicate question. All I saw in the others threads, it was showing how to get all
the values from a select, while I just need one... All the others values i'm passing by parameters/strings . . .
Upvotes: 2
Views: 185
Reputation: 37388
You can mix the hard-coded variables, and the value from your table in a select
statement:
INSERT INTO chamados (club, project, function, description, priority)
SELECT club, @proj, @func, @description, @pri
FROM YourTable
Upvotes: 3