[Zope-DB] how to insert values from select in one shot?

Andreas Jung lists at andreas-jung.com
Mon Mar 14 08:23:00 EST 2005


I *think* you can not use a select and an insert statement within one ZSQL 
query...
at least not where the insert statement depends on the select statement 
before.

-aj

--On Montag, 14. März 2005 14:09 Uhr +0100 Jaroslav Lukesh 
<lukesh at seznam.cz> wrote:

> Dear sirs,
>
> I need to past values from SELECT into INSERT to clone some values, but I
> receive error from MSSQL for SQL commands below (The name 'Customer_Id'
> is  not permitted in this context. Only constants, expressions, or
> variables  allowed here. Column names are not permitted.).
>
> Would you like to know me, how I can successfully clone some filed values
> insde SQL sequence, please? Note, that jobs.Job_id is automatic index.
> Many  thanks for your help.
>
> <params>
>     user_id:int
>     job_id:int
>     problem:string
> </params>
>
> SELECT
>     jobs.Job_id,
>     jobs.Customer_Id,
>     jobs.Problem,
>
> FROM
>     jobs
>
> WHERE
>     jobs.job_id = <dtml-sqlvar job_id type="int">
>
> <dtml-var sql_delimiter>
>
> INSERT INTO
>     jobs (
>         jobs.Customer_Id,
>         jobs.Problem,
>     )
>
> VALUES (
>     jobs.Customer_Id,
>     <dtml-sqlvar problem type="string">,
> )
>
>
>
> --
>
>                         Jaroslav Lukesh
>   -----------------------------------------------------------
>   This e-mail can not contain any viruses because I use Linux
>
> _______________________________________________
> Zope-DB mailing list
> Zope-DB at zope.org
> http://mail.zope.org/mailman/listinfo/zope-db



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope-db/attachments/20050314/64bfa156/attachment.bin


More information about the Zope-DB mailing list