Fdquery the problem of generating SQL statements with multiple table updates

Source: Internet
Author: User

Query.sql= ' Select A,b,c,d,e from a,b,c where ... ';

Source 3 Tables,

Add field list at design time with Origin property for each field

is the A.A,B.B,C.C format, which indicates that the field is the table.

Then query.edit,query.post the method call, when the update or INSERT statement is generated,

UPDATE TTDB.DBO.A

SET [A.A] = @P1
WHERE [A.A] = @P2

and [a.b] = @p3

SQL Server error, prompt

MSG 207, Level 16, State 1, line 3rd
Column name ' A.A is not valid.

Database field must exist, just add [] do not recognize, remove [] do not error, plus [] field name [a] is identifiable, such as

[table1.a],[t1.b],[t1.c]; This is the existence of an unrecognized column. t1.a,t1.b,t1.c this is recognizable. The statement generated by the previous paragraph FIREDAC automatically added [] cannot be removed.

In the Source\data\firedac\firedac.dapt.pas file,

ArUpdate:Result.CommandText: = ocmdgen.generateupdate;

Is the method in the FireDAC.Phys.SQLGenerator.pas file, Getwhere method, GetColumn and Normalizecolname method Most added [], temporarily can not find where to go. Fgenoptions also has no place to assign calls, so abandon this idea.

Query has the Updateoptions>updatetablename property set to the name of the table to be updated, and then the origin prefix of each field is removed so that the resulting UPDATE statement has only the column name and no prefix [field]; try.

SELECT [FieldName] FROM table//column exists
Select Table1.fieldname from table//column exists
SELECT [Table1.fieldname] FROM table//column does not exist.

Fdquery the problem of generating SQL statements with multiple table updates

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.