[Zope-DB] how to insert values from select in one shot?
Greg Fischer
retheoff at gmail.com
Tue Mar 15 11:05:41 EST 2005
INSERT INTO jobs (Customer_Id, Problem)
SELECT jobs.Customer_Id, jobs.Problem
FROM jobs
WHERE jobs.job_id = <dtml-var job_id>
That should work in mssql, try that. (slightly modified from Charlie)
Greg
On Tue, 15 Mar 2005 03:28:01 +0100, Jaroslav Lukesh <lukesh at seznam.cz> wrote:
> Dne pondělí, 14. března 2005 14:38 Charlie Clark napsal(a):
> > > 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.
> >
> > Hi Jaroslav,
> >
> > depending on your DB this is quite easy using SELECT from within your
> > INSERT, ie. invert the order of your statements. SQL is confusing and
> > inconsistent like that. Check your documentation for complete details.
> >
> > Charlie
> >
> > INSERT INTO jobs
> >
> > (Customer_Id, jobs.Problem,)
> >
> > SELECT
> > jobs.Job_id,
> > jobs.Customer_Id,
> > jobs.Problem,
> >
> > FROM
> > jobs
> >
> > WHERE
> > jobs.job_id = <dtml-sqlvar job_id type="int">
>
> Many thanks for your help, it but it does not work with MSSQL, so I must split
> it into two ZSQL methods+dtml :(
>
> --
>
> 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
>
--
Greg Fischer
1st Byte Solutions
http://www.1stbyte.co
More information about the Zope-DB
mailing list