[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 1.3 - Inject part directly to the parts table

Hi Istvan,

Try putting parens "(...)" around the SELECT statements; afaik that should work.



On Sun, Feb 2, 2014 at 11:58 AM, Pongrácz István <..hidden..> wrote:


I am working on a method to inject parts into the database directly.

I figured out the parts id, and partnumber auto increment, which basically was the key point from my point of view.

So, to be able to add a new record to the parts table, it needs to build a proper record.

The sequences needed to get the id and partnumber correctly, I can use the following two sql commands:

select nextval('parts_id_seq');   -> gives a new id for the parts table
select value from sequence__increment('Monitors');   -> build up the new partnumber (using sequences addon, otherwise it needs an other increment)

So, the first part is ok.

I have a sample record, which is the basis to build up the correct record, which includes all default settings, like accounts, units etc.

So, my question, how to build up the right sql syntax, preferably in one-liner?

Obviously, the following sql command does not work, check the red fields: id, partnumber.

insert into parts (id,partnumber,description,unit,listprice,sellprice,lastcost,priceupdate,
(select nextval('parts_id_seq'),
select value sequence__increment('Monitors'),
'Test part',

I know, the syntax is not ok, if you can answer it quickly, you can save some time for me :) I start to figure out the solution by learning more about sql.



WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
Ledger-smb-devel mailing list



http://efficito.com -- Hosted accounting and ERP.
Robust and Flexible. No vendor lock-in.