lundi 16 février 2015

Subqueries are not allowed in this context -- SQL statement from 2008 to 2005

I have a SQL statement which run in a window form application. I am using SQL server 2008 to develop and test. Everything is alright here.



SqlCommand command1 = new SqlCommand("insert into payment_detail ( " +
"transaction_id, enrolment_id, hkid_1, section_r, " +
"classes, section_fee, assist_amt, additional_assist_amt, " +
"discount_amt, coupon_amt, coupon_amt_no_number, " +
"paid_amt, last_updated_by, last_updated_date) values " +
"(@transaction_id, @enrolment_id, @hkid_1, @section_r, " +
"@classes, @section_fee, (select section_fee - adjusted_section_fee from coursenew where coursecode = @courseCode and section_r = @section_r), @additional_assist_amt, " +
"@discount_amt, @coupon_amt, @coupon_amt_no_number, " +
"@paid_amt, @last_updated_by, GETDATE())"
, myConnection);


But when moving to another work station which is using SQL server 2005. It prompts out an error like below


Subqueries are not allowed in this context. Only scalar expressions are allowed.


I am sorry that since a computer can only install one version of SQL server. I cannot test the script with a SQL server 2005.


Please help and thanks.


Aucun commentaire:

Enregistrer un commentaire