Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2007
    Posts
    6

    Question Unanswered: strange insert problem

    question structure
    - code
    - message after execute qurie
    - question
    - database diagram


    CODE:
    Code:
    SET DATEFORMAT dmy;
    INSERT INTO tblAddress (fkCityId, strAddressFull)
    SELECT pkCityId,'street_209' 
    FROM tblCity 
    WHERE strCityName = 'Test-City';
    
    INSERT INTO tblCustomer (fkCustomerLanguageId, fkCustomerGenderId, strCustomerName, strCustomerFirstname, dtCustomerBirthDate) SELECT pkLanguageId, pkCustomerGenderId,'test','user','8/03/2007 9:25:17' 
    FROM tblCustomerGender, tblCustomerLanguage 
    WHERE tblCustomerGender.strCustomerGenderName ='Male' and tblCustomerLanguage.strLanguageAbbrev ='Dutch';
    
    INSERT INTO tblCustomerAddress(fkCustomerId, fkAddressId) 
    SELECT c.pkCustomerId, a.pkAddressId 
    FROM tblCustomer AS c, tblAddress AS a 
    WHERE c.strCustomerName = 'test' and c.strCustomerFirstname = 'user' and  c.dtCustomerBirthDate = '8/03/2007 9:25:17' and a.strAddressFull ='street_209';
    
    INSERT INTO tblAddressCategorie(fkCategorieAddressId, fkAddressId) 
    SELECT c.pkCategorieAddressId, a.pkAddressId FROM tblAddress AS a, tblCategorieAddress AS c 
    WHERE c.strCategorieName = 'Invoice' and a.strAddressFull = 'street_209';
    
    INSERT INTO tblAddressCategorie(fkCategorieAddressId, fkAddressId) 
    SELECT c.pkCategorieAddressId, a.pkAddressId 
    FROM tblAddress AS a, tblCategorieAddress AS c 
    WHERE c.strCategorieName = 'Privat' and a.strAddressFull = 'street_209';

    MESSAGE:

    (1 row(s) affected)

    (1 row(s) affected)

    (1 row(s) affected)

    (1 row(s) affected)

    (0 row(s) affected)


    QUESTION:
    last insert query is not done... why, because he is the same as the query before (only the data is different)???

    if i only insert 1 thing in tblAddressCategorie, then he insert it correctly
    if i insert 2 things he only insert the first
    if i insert 3 things he only insert the first 2
    if i insert 4 things he only insert the first 3
    if i ...


    DATABASE DIAGRAM:
    database diagram that is involved with this problem:
    see picture
    Attached Thumbnails Attached Thumbnails dtbproblem.JPG  
    Last edited by BoardD; 03-08-07 at 06:33.

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by BoardD
    last insert query is not done... why, because he is the same as the query before (only the data is different)
    Most probably because
    Code:
    FROM tblAddress AS a, tblCategorieAddress AS c 
    WHERE c.strCategorieName = 'Privat' and a.strAddressFull = 'street_209';
    does not return any rows.

  3. #3
    Join Date
    Feb 2007
    Posts
    6
    hmmm... you're right, from one strange reasen my vb.net cuts the last letter of and then i become privat...

    thanks dude...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •