请帮我改写下面的插入查询优化。
我的stored procedure
包含这些类型的插入查询,我希望通过替换
stored procedure
INSERT INTO [allassetsurveyreport]
SELECT Replace(srno, 'string;#', '') AS SRNO,
'Yes' AS Responded,
'Yes' AS IsOldReport,
NULL AS [Status],
[pleaserateyour_x00] AS [Overall Satisfaction],
[easeofuse] AS [Ease of Engaging],
responsiveness AS Professionalism,
[qualityofthedeliverable] AS [Quality of Document],
NULL AS BulkUploadReason,
NULL AS [Requested FY],
NULL AS [Requested FM],
NULL AS Vertical,
NULL AS Industry,
NULL AS PrimaryContact,
NULL AS [Topic for Proposal]
FROM [rfx_survey]
答案 0 :(得分:0)
我的回答仅适用于您插入此数据的表格,其中所有列的默认值均为NULL或'是'所有其他值都直接从第二个表中获取。
然后你可以使用:
INSERT INTO [allassetsurveyreport]
([Overall Satisfaction],
[Ease of Engaging],
Professionalism,
[Quality of Document])
SELECT [pleaserateyour_x00] AS [Overall Satisfaction],
[easeofuse] AS [Ease of Engaging],
responsiveness AS Professionalism,
[qualityofthedeliverable] AS [Quality of Document]
FROM [rfx_survey]
如果您按正确的顺序选择列,我不确定是否需要AS。