ZUpdateSQL with 2 Tabels with Autoinc-Field
Posted: 25.04.2007, 17:25
Hi
I'm using ZQuery with Select-Query and I am using this 2 tables:
Artikel:
ID : autoinc
Name: string,
...
AtikelBild:
ArtikelID: integer
Bild: blob,
...
the query looks like this
This query works perfect, but is obvouslly not writable. So I am trying to work with ZUpdateSQL. The Problem is the Insert-Statement, that looks liek this:
The problem is the 2. line. Just after executing the 1. line, the value of ID is known. But at the 2. I need this value. The question is now, how I have to change the Statement, so that i can us the value of the 1. line directly after in the second line? Or does there exists another solution?
I found here in the forum the tip to use RETURNING. But I am using MSSQL and it looks as it this function is not integrated for this DB. Or did i made a mistake?
Oh by the way, I am using a DBCTRLGrid to insert information.
Thanks for every answer
Chaosworld
PS: sorry i wrote this text first in german. I was looking here and also a lot with google and was reading before in german so that i forgot that english is used in this forum!
I'm using ZQuery with Select-Query and I am using this 2 tables:
Artikel:
ID : autoinc
Name: string,
...
AtikelBild:
ArtikelID: integer
Bild: blob,
...
the query looks like this
Code: Select all
Select * from Artikel, AtikelBild where artikel.ID=artikelbild.artikelID
Code: Select all
Insert into Artikel (Name,...) Value (:Name,..);
Insert into AtikelBild (ArtikelID,Bild,...) Value (:ID, :Bild..);
I found here in the forum the tip to use RETURNING. But I am using MSSQL and it looks as it this function is not integrated for this DB. Or did i made a mistake?
Oh by the way, I am using a DBCTRLGrid to insert information.
Thanks for every answer
Chaosworld
PS: sorry i wrote this text first in german. I was looking here and also a lot with google and was reading before in german so that i forgot that english is used in this forum!