Page 1 of 1

How to insert DEFAULT?

Posted: Mon 19 Jan 2015 14:55
by to2
I'm using a TUniQuery Component and I'm able to construct an SQL command string to insert new data to a table. Now I'm testing TUniQuery::SQLInsert and fields to prevent me from building commands on string level. As I have found out field names have to be defined in the TUniQuery::SQLInsert::Text and their values have to be set before a TUniQuery::Post is called.

Sometimes I want to set a value for the field but in other situations I would like the database set their default value for it. In other words I'd like to pass a DEFAULT then. How can I do this without altering the TUniQuery::SQLInsert::Text?

Re: How to insert DEFAULT?

Posted: Mon 19 Jan 2015 18:36
by FCS
Hello,

Did you try ?

UQ.Options.DefaultValues:=true;

Regards
Michal

Re: How to insert DEFAULT?

Posted: Tue 20 Jan 2015 09:33
by to2
Did you try ? UQ.Options.DefaultValues:=true;
Saw it, but didn't try. I was looking for a field property DEFAULT. But this global Options.DefaultValues is the better approach. I have to fill known values only and unknown are set by DBMS. I've tried it - works fine.

Thx

Re: How to insert DEFAULT?

Posted: Wed 21 Jan 2015 09:58
by azyk
It is good to see that the problem has been solved. Feel free to contact us if you have any further questions about UniDAC.