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

Jaroslav Lukesh lukesh at seznam.cz
Mon Mar 14 08:09:14 EST 2005


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



More information about the Zope-DB mailing list