Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 1 of 1 total |
INSERT-SELECT bug |
Mon, Mar 31 2008 4:24 AM | Permanent Link |
"David Cornelius" | It appears that when I execute the following SQL statement to copy
records with a new value: INSERT INTO TableA (field1, field2, field3) SELECT 'constant-value', field2, field3 FROM TableB WHERE field3 = 'XYZ' that if there are several records that match the WHERE clause, there will be several new records in the table (as expected) but only the first of those will have field1 set to the 'constant-value'. Since the SELECT statement by itself with a 'constant-value' works fine, the work around is to put the SELECT clause into a CURSOR with a WHILE NOT EOF loop and select each field into a variable, then use the explicit form of the INSERT command inside the WHILE loop. -- David Cornelius CorneliusConcepts.com custom designed software |
This web page was last updated on Monday, April 29, 2024 at 05:23 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |