Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2010
    Posts
    3

    Unanswered: I have createstore procedure in mysql i got error on convert function

    Dear freinds

    I have create following store procedure then i got error in start transaction and convert function. Please help me for this issue.

    Create procedure usp_get_next_content_id ()

    begin

    strat transaction

    SELECT value FROM process_params WHERE code = 'NEXT_CONTENTID' ;

    UPDATE process_params SET value = CONVERT(INT,value) + 1
    WHERE code = 'NEXT_CONTENTID' ;

    commit

    END


    thanks!
    Anand

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Have you copy pasted that?

    We don't use start transaction in SQL Server; it's BEGIN TRANSACTION and COMMIT TRANSACTION (or even ROLLBACK TRANSACTION).

    What is the data type of the column "value"? I'm going to assume it's not an integer, which is why you're converting it in the first place. If so, the resultant data type is an integer, so you'll need to convert it back to the original data type to get this to work. e.g.
    Code:
    value = Convert(char(10), Convert(int, value) + 1)
    George
    Home | Blog

  3. #3
    Join Date
    Jan 2010
    Posts
    3
    thank you for your reply

    I have done it but got same error as per following

    Script line: 4 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Convert(int, value) + 1)
    WHERE code = 'NEXT_CONTENTID';

    END' at line 5

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    my advice is that you look up da syntax in da manual

    that would certainly lead you to solving the CONVERT error a lot faster than posting on a forum and waiting for an answer
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by gvee View Post
    We don't use start transaction in SQL Server
    who cares???

    dis be da MySQL forum

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  6. #6
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I didn't realise I was delving in to MySQL, my bad
    George
    Home | Blog

Posting Permissions

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