请帮我重写下面的插入查询优化。我的stored procedure包含了这些类型的insert查询,这里我想通过替换以下代码来加快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] 发布于 2014-05-23 19:46:17
只有当您插入此数据的表中所有列的默认值都为NULL或'Yes‘,并且所有其他值都直接取自第二个表时,我的答案才有效。
然后,您可以使用:
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。
https://stackoverflow.com/questions/23827973
复制相似问题