1

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)

2 Answers 2

2

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á

Sign up to request clarification or add additional context in comments.

Comments

0

In case you have to put string quote around A1

="INSERT INTO map.UserSurveys (surveyId,userId,activeQuestions) VALUES (50, '" & A1 & "', 1)"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.