Results 1 to 3 of 3

Thread: [RESOLVED] Peculier , MySQL stored procedure inserting data of VARCHAR as 0 and 1

  1. #1

    Thread Starter
    PowerPoster make me rain's Avatar
    Join Date
    Sep 2008
    Location
    india/Hubli
    Posts
    2,208

    Resolved [RESOLVED] Peculier , MySQL stored procedure inserting data of VARCHAR as 0 and 1

    With MySQL
    i have a stored procedure which writes the data into table, and it does But the VARCHAR is getting stored as 0 and 1
    here is my stored procedure
    vb.net Code:
    1. CREATE DEFINER = `root`@`localhost` PROCEDURE `ACC_AP_Proofing`(IP_ACCID_FK SMALLINT(4) , IP_FTPpath VARCHAR(125) ,IP_description VARCHAR(25) , IP_Deo VARCHAR(100))
    2. BEGIN
    3.  
    4. #ACC_AP_Proofin
    5.  
    6. INSERT INTO acc_proofing (
    7. acc_proofing.ACCID_FK,
    8. acc_proofing.FTPpath,
    9. acc_proofing.description,
    10. acc_proofing.Deo ,
    11. acc_proofing.docid_pk ) VALUES (
    12. acc_proofing.ACCID_FK = IP_ACCID_FK,
    13. acc_proofing.FTPpath = IP_FTPpath,
    14. acc_proofing.description = IP_description,
    15. acc_proofing.Deo = IP_Deo ,
    16. acc_proofing.docid_pk = NULL
    17. );
    18.  
    19.  
    20. END;
    What is going wrong please
    The averted nuclear war
    My notes:

    PrOtect your PC. MSDN Functions .OOP LINUX forum
    .LINQ LINQ videous
    If some one helps you please rate them with out fail , forum doesn't expects any thing other than this

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Peculier , MySQL stored procedure inserting data of VARCHAR as 0 and 1

    Your VALUES clause is wrong. You are mixing up an INSERT with an UPDATE statement, where you do assign a value to a column. In your INSERT statement, you have already specified the columns in the first set of parentheses. The VALUES clause should contain ONLY the values:
    sql Code:
    1. INSERT INTO acc_proofing (
    2. acc_proofing.ACCID_FK,
    3. acc_proofing.FTPpath,
    4. acc_proofing.description,
    5. acc_proofing.Deo ,
    6. acc_proofing.docid_pk ) VALUES (
    7. IP_ACCID_FK,
    8. IP_FTPpath,
    9. IP_description,
    10. IP_Deo ,
    11. NULL
    12. );
    The reason you were getting 0 or 1 would be that your attempt at assignment was being interpreted as comparison and the result of that would be a Boolean value, 1 for True if the column was equal to the value and 0 for False if it wasn't.

  3. #3

    Thread Starter
    PowerPoster make me rain's Avatar
    Join Date
    Sep 2008
    Location
    india/Hubli
    Posts
    2,208

    Re: Peculier , MySQL stored procedure inserting data of VARCHAR as 0 and 1

    Oh my god
    Thanks sir
    The averted nuclear war
    My notes:

    PrOtect your PC. MSDN Functions .OOP LINUX forum
    .LINQ LINQ videous
    If some one helps you please rate them with out fail , forum doesn't expects any thing other than this

Posting Permissions

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



Click Here to Expand Forum to Full Width