If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > I have createstore procedure in mysql i got error on convert function

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-06-10, 07:59
anandbkhal anandbkhal is offline
Registered User
 
Join Date: Jan 2010
Posts: 3
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
Reply With Quote
  #2 (permalink)  
Old 01-06-10, 08:05
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
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
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 01-06-10, 08:19
anandbkhal anandbkhal is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 01-06-10, 08:38
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
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
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 01-06-10, 08:40
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
Quote:
Originally Posted by gvee View Post
We don't use start transaction in SQL Server
who cares???

dis be da MySQL forum

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #6 (permalink)  
Old 01-06-10, 08:46
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
I didn't realise I was delving in to MySQL, my bad
__________________
George
Twitter | Blog
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On