2016-03-11 26 views
2

我正在使用SQL Server Management Studio來測試一些SQL查詢,並且下面的查詢被稱爲'語法附近','',它是'image_uuid 」。我閱讀了語法,我想我正確列出了列。SQL Server Management Studio表示此語句不正確

我需要將行從一個表移動到一個存檔表。我將使用這個語句,然後刪除我移動的行。如果有更清晰的方法可以做到這一點,請說明我還能做些什麼。謝謝!

INSERT INTO litmus_mailing_archive(image_uuid, server_id, list_id, mailing_id, 
        litmus_job_id, email_subject, test_email_message_id, 
        test_running, test_started, test_finished, 
        ended_with_error, images_purged, notification_email) 
    SELECT 
     (image_uuid, server_id, list_id, mailing_id, 
     litmus_job_id, email_subject, test_email_message_id, 
     test_running, test_started, test_finished, 
     ended_with_error, images_purged, notification_email) 
    FROM 
     litmus_mailing 
    WHERE 
     server_id = ? 
     AND list_id = ? 
     AND mailing_id = ? 
     AND test_running = 'false'; 

問號只是信息的佔位符。當我測試它時,我插入litmus_mailing中的實際數據。

+0

我認爲錯誤是在第二個'image_uuid'之後?在這種情況下,它是'('圍繞你的SELECT語句中的列AFAICT。 –

回答

5

從選擇查詢中刪除括號:

SELECT (image_uuid, server_id, list_id, mailing_id, 
litmus_job_id, email_subject, test_email_message_id, 
test_running, test_started, test_finished, ended_with_error, 
images_purged, notification_email) 

更改它以這樣的:

SELECT image_uuid, server_id, list_id, mailing_id, 
litmus_job_id, email_subject, test_email_message_id, 
test_running, test_started, test_finished, 
ended_with_error, images_purged, notification_email 
1

周圍的SELECT字段列表中刪除括號。

相關問題