On 9/13/2006 6:20 PM, Ben Blake wrote:
> On Thu, 14 Sep 2006, at 6:22:41, Charles Calvert wrote:
>
>> On 9/12/2006 6:46 PM, Ben Blake wrote:
>>>
>>> I am having trouble with inserting rows using INSERT INTO, all I ever
>>> get is 5 rows added!
>>>
>>> I have created my tables and indexes (REAL SQL Database):
>>> db.SQLExecute("create table Summary(Grp string, Cat string, Year
>>> Integer, Month Integer, Tot Double)")
>>> db.SQLExecute("create index Summary_idx on Summary(Grp, Cat, Year)")
>>> db.SQLExecute("create table Category_List(Grp string, Type string, Cat
>>> string, SortPriority Integer)")
>>>
>>> Now I need to initialise the summary with zeros for each of the
>>> Categories and Groups (makes it easier so my updating code doesn't have
>>> to check if the item exists or not). Using the following code
>>> (Category_List table contains 50-60 rows) only ever insert 5 rows!
>>>
>>> db.SQLExecute("INSERT INTO Summary select Grp, Cat, 8, 1, 0 from
>>> Category_List")
>>
>> Try:
>>
>> INSERT INTO Summary (Grp, Cat, Year, Month, Tot)
>> SELECT Grp, Cat, 8, 1, 0 FROM Category_List
>>
>> Also, what happens if you run just the selection:
>> "SELECT Grp, Cat, 8, 1, 0 FROM Category_List"
>>
>> How many rows are returned?
>
> I tried this and I get the same result as before, 5 rows.
I'm not surprised. :(
> As for running the select query I get 84 rows.
What happens if you try to insert the rows manually, one by one? Insert
the first five rows so that you are duplicating the five rows you get
when doing it using your original method, then try to insert a sixth
row. Do you get an error?
Also, are you doing your testing by writing the queries into a program
and then running it, or via a query tool?
--
Charles Calvert
Celtic Wolf, Inc.
(703) 580-0210
[EMAIL PROTECTED]
http://www.celticwolf.com/
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>