SQLstring的Excel语法

我需要在引用另一个单元格的单元格中写入SQL插入语句。 什么是正确的语法来做到这一点? 需要引用另一个单元格的部分在下面写为{单元格的值}:

INSERT INTO map.UserSurveys (surveyId,userId,activeQuestions) VALUES (50, {value of cell}, 1) 

如果该值是一个数字:

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

如果该值是一个string:

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

在这两种情况下,replace你想要的单元格A1和Voilá

万一你必须把string引号A1

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