Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 3 of 3 total |
Sql with diferrent value type |
Tue, Mar 16 2010 6:55 AM | Permanent Link |
Hershcu Sorin | Hello
I have the following code: query1.SQL.Text := 'SELECT Field0, Field1, Field2 FROM Table1'; query1.Open; query2.SQL.Text := 'INSERT INTO Table2 (Field0, Field1, Field2, Field3)' + 'VALUES (' + myLocalVar + ', ' + query1.FieldByName('Field1').AsVariant + ', ' + query1.FieldByName('Field2').AsVariant + ')'; query2.ExecSql; The problem is that Field1, Field2 can be integer and can be NULL. What are the correct statements to create that code lines? Thanks Sorin |
Tue, Mar 16 2010 7:33 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Sorin
Try this SQL.Text := 'INSERT INTO Table2 ((Field0, Field1, Field2, Field3) SELECT' + myLocalVar + ' Field0, Field1, Field2 FROM Table1' Roy Lambert [Team Elevate] |
Tue, Mar 16 2010 1:58 PM | Permanent Link |
Hershcu Sorin | > Try this
> SQL.Text := 'INSERT INTO Table2 ((Field0, Field1, Field2, Field3) SELECT' > + myLocalVar + ' Field0, Field1, Field2 FROM Table1' Simple and work. Thanks Sorin |
This web page was last updated on Saturday, April 27, 2024 at 08:52 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |