Reputation: 13763
I need to write an SQL insert statement in cells that reference another cell. What would be the correct syntax to do this? The part that needs to reference another cell is written below as {value of cell} :
INSERT INTO map.UserSurveys (surveyId,userId,activeQuestions) VALUES (50, {value of cell}, 1)
Upvotes: 1
Views: 230
Reputation: 66727
If the value is a number:
="INSERT INTO map.UserSurveys (surveyId,userId,activeQuestions) VALUES (50, " & A1 & ", 1)"
If the value is a string:
="INSERT INTO map.UserSurveys (surveyId,userId,activeQuestions) VALUES (50, '" & A1 & "', 1)"
In both cases replace A1
for the cell that you want and voilá
Upvotes: 2
Reputation: 26396
In case you have to put string quote around A1
="INSERT INTO map.UserSurveys (surveyId,userId,activeQuestions) VALUES (50, '" & A1 & "', 1)"
Upvotes: 0