473,385 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to insert data by calling procedure

Hi all,
as part of my project requirement we are migrating procedures from mssql to mysql
below is the code in mssql
Expand|Select|Wrap|Line Numbers
  1. CREATE PROCEDURE TABLE_DEPEND_INSERT_ORDER
  2. AS
  3.   CREATE TABLE #TABLE_DEPEND_ORDER_SUMMARY (
  4.     TABLE_NAME varchar(128),
  5.     SORT_ORDER int
  6.   )
  7.   INSERT INTO #TABLE_DEPEND_ORDER_SUMMARY EXEC TABLE_DEPEND_ORDER 'F'
  8.   SELECT TABLE_NAME FROM #TABLE_DEPEND_ORDER_SUMMARY ORDER BY SORT_ORDER DESC;
  9.  
how can i insert data by calling the stored procedure as above.
please do the need full.
Regards,
Vijaya
Aug 18 '08 #1
4 6023
Atli
5,058 Expert 4TB
Hi.

What is it that you are trying to do there? (I don't speak Microsoft)

What have you tried so far?
Why / how isn't it working?
Got any errors that may help find the problem?

We are happy to help you solve problems with your code, but we will not write it for you.

Also.
Please post your code examples inside [code] tags (See How to Ask a Question).
This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.
Please use [code] tags in future.

MODERATOR.
Aug 18 '08 #2
Hi, here is the procedure i created in mysql as replacement of the above mssql one.
Expand|Select|Wrap|Line Numbers
  1. CREATE PROCEDURE TABLE_DEPEND_INSERT_ORDER()
  2. begin
  3.   CREATE TEMPORARY TABLE TABLE_DEPEND_ORDER_SUMMARY (
  4.     TABLE_NAME varchar(128),
  5.     SORT_ORDER int
  6.   );
  7.   INSERT INTO TABLE_DEPEND_ORDER_SUMMARY call TABLE_DEPEND_ORDER ('T','F')
  8.   SELECT TABLE_NAME FROM TABLE_DEPEND_ORDER_SUMMARY ORDER BY SORT_ORDER DESC;
  9.   end
  10.  
when i compile this code it is giving me the below error message
Expand|Select|Wrap|Line Numbers
  1. 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 'call TABLE_DEPEND_ORDER ('T','F')
  2.   SELECT TABLE_NAME FROM TABLE_DEPEND_ORDER_S' at line 7
  3.  
please provide me solution

Regards,
vijaya
Aug 19 '08 #3
Atli
5,058 Expert 4TB
vijaya.

I tried asking you nicely. Now I am telling you:
Use [code] tags when posting your code examples.

Following the Posting Guideliens is not optional, and failing to do so will get you banned from these forums.

I would prefer not to have to do that, so please read the guideliens and follow them in the future.

MODERATOR
Aug 19 '08 #4
Atli
5,058 Expert 4TB
As to your code.

You can not call a procedure in the middle of an INSERT statement.
Procedures dont' technically return a value, although they can be used to display the result of a SELECT.

Not knowing what this "TABLE_DEPEND_ORDER" procedure does, I would suggest trying to fuse the two procedures together.

That is; try to use the INSERT INTO table SELECT syntax, like:
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO tempTable SELECT * FROM realTable;
  2.  
You won't be able to just copy/past the MSSQL syntax into MySQL, even if you replace the keywords, as you did.
The way in which they implement procedures is very different. You will probably have to re-design a lot of them to fit them into MySQL's implementation.
Aug 19 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Bill Kellaway | last post by:
Hi there - this should be fairly simple for someone. Basically I can't figure out how to pass the parameters from ASP to a Stored Procedure on SQL. Here's my code: I just need to help in...
2
by: Eli | last post by:
Hi all We currently have a strange problem with calling a Stored Procedure (SQL Database) in our C# Project. The only error I get is "System error" which says a lot :) Background: We have...
7
by: | last post by:
I am having trouble figuring out to call a database INSERT procedure from a simple submit form. It appears I should use the onclick event to trigger the procedure called BUT when I do this I...
3
by: c676228 | last post by:
Hi all, I think I have data type problem when I tried to insert data into sql server 200. The erroe message is like this: system.invalidcastexception data type DFlage char(1) in sql 2000, DMI...
2
by: wombat53 | last post by:
Hi Group Are there any DB2 UDB ESE DPF V8.2 users exploiting "buffered inserts" (BIND parm INSERT BUF) *and* "multi-row INSERTS" (many rows associated with the VALUES clause of the INSERT to...
3
by: Tim Satterwhite | last post by:
Hi All, I think this is a thorny problem, and I'm hoping you can help. I've not found this exact issue described anywhere yet. I have a stored procedure that calls BULK INSERT on a set of...
2
by: dublyner | last post by:
I am having an issue with linked servers on Windows 2000 running SQL 2005. I created the following test case to simplify an issue. I created a small procedure that selects the max site_no from a...
13
nabh4u
by: nabh4u | last post by:
hi, I am trying to insert multiple rows in a table using PL/SQL. I have two procedures and two tables. the first procedure gets the data from the source table, manipulates it and then sends the...
1
by: Smurfas | last post by:
Hi, i Write in two table (HelpDesk nad HelpDesk2) + use Stored Procedure(InsertHelpDesk and InsertHelpDesk2) In first table (HelpDesk) don't insert record. Why? in second (HelpDesk2) all ok....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.