[DUG] SQL - INSERT

Jeremy Coulter vss at vss.co.nz
Thu Sep 1 13:35:31 NZST 2005


The first obvious quest...why is there a space in a field name for a start?
Second, not sure whate DB you are using, but MSSQL and Access both will let 
you put square brackers around the field name, i.e. [school id]

If it was me, I woudl replace the space with an underscore, i.e. school_id  

Jeremy

-----Original Message-----
From: "Dennis Chuah" <dennis_cs_chuah at hotmail.com>
To: <john at padasy.co.nz>, "NZ Borland Developers Group - Delphi List" 
<delphi at ns3.123.co.nz>
Cc: 
Date: Thu, 1 Sep 2005 13:21:34 +1200
Subject: Re: [DUG] SQL - INSERT

> 
> Use double quotes for your field name and you also need the name of the
> table you are inserting into.
> 
> INSERT INTO <tablename> ("School ID", "Name")
> VALUES('22222', 'TEST')
> 
> 
> ----- Original Message ----- 
> From: "John" <john at padasy.co.nz>
> To: "DUG" <delphi at ns3.123.co.nz>
> Sent: Thursday, September 01, 2005 1:15 PM
> Subject: [DUG] SQL - INSERT
> 
> 
> > Hi folks
> >
> > Assume I have a table with a field name including a space character
> (e.g.
> > "School ID").
> >
> > How can I specify an INSERT query, as the query listed below fails
> due to
> > the space character in the field name!
> >
> >
> > INSERT INTO ('School ID', 'Name')
> > VALUES('22222', 'TEST')
> >
> >
> > Regards
> > John
> >
> > _______________________________________________
> > Delphi mailing list
> > Delphi at ns3.123.co.nz
> > http://ns3.123.co.nz/mailman/listinfo/delphi
> > 
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi




More information about the Delphi mailing list