stored-procedures

Change the owner of a MySQL Stored Procedure?

The MySQL Manual says that I can print the code used to define a stored procedure using SHOW CREATE PROCEDURE, but apparently that only works if you a) have select permissions on the mysql.proc table, or b) own the procedure. The database in question was maintained by a co-worker who's moved on, so I should be the owner of all the stuff...

Calling stored proc with LINQ .ExecuteQuery to return non-mapped fields

I have a stored procedure which returns all the fields of a table plus one, ie: tablename.*,count(suchandsuch) Of course, when executing this via LINQs ExecuteQuery I can get back instances of the table's class in an IEnumerable<>, but I also want the extra field which the stored proc tacks on. Is this possible? My current code look...

sybase: get list of stored procedures using a particular table

Hi, I have 500 store procedures in a sysbase database. Using sql, can i get list of all stored procedures that are using a particular table say "tbl_books" Thanks ...

how to call stored procedure using spring and hibernate

I get an error message as java.lang.reflect.UndeclaredThrowableException and Invalid column name. Can you help me why am i getting this error. ...

SQL script how to add a tab or new line within script

I have a SQL script that acquires table names and creates trigger for those tables. When I open the trigger after creating it all of the code is on one line. How would I go about adding tab and new line characters within the script to make the trigger more readable. Example code: SET @SQL = 'ALTER TRIGGER [dbo].[TRG_' + SUBSTRING(@TABL...

SQL stored proc - help me write this one, please!

Hi Guys, Could you please help me with this one: In one of my scripts I am inserting some data in to some table "Item". One of the columns in the "Item" table is "ItemNumber". I want to be able to call some function (most probably a Stored proc) where it would return me a numeric number which I can use for the ItemNumber. I CAN NOT ...

Optimizing Magento-using Websites

Please be patient with my question, as this may be a bit longer. If you look at Magento and try to compare with any other non-PHP eCommerce Shopping Cart websites, you will find that the latter are comparatively faster. I know that the following factors work as well:- Hosting Server Bandwidth Magento offers lots & lots of features, ...

SQL stored proc - help me write this one, please! (part 2)

I have the following table with the value 501 in it.. CREATE TABLE _Numbers( Number numeric(20,0) NOT NULL PRIMARY KEY ) INSERT INTO _Numbers VALUES(501) How can I write a stored proc on this which returns me 501 and increments Number to next in sequence (i.e. 502)? I would like this behaviour repeated every time the stored proc i...

Storing variables from queries in stored procedures

I have a stored procedure with a username parameter. I want to use one query to grab a userid, then use this variable in further queries. Here's what I have so far. It compiles OK, but on execution I get an error "Error converting data type varchar to uniqueidentifier." ALTER PROCEDURE [dbo].[sp_User_delete] @username uniqueidentif...

Regarding Oracle Stored Procedure not compiling because table does not currently exist

All, I have the following Package Description: CREATE OR REPLACE PACKAGE ashish.PKG_Customer AUTHID CURRENT_USER AS TYPE cursorType IS REF CURSOR; PROCEDURE CreateCustomerTable; PROCEDURE SelectCustomers(o_ResultSet OUT cursorType); END PKG_Customer; and here is the package body: CREATE OR REPLACE PACKAGE BODY ashish.PKG_...

Question about data access with LINQ and Stored Procs (NOT asking which is better!)

First, I am NOT trying to spur yet another debate about LINQ vs. stored procedures. Assume for this question (for right or wrong) that I'm going to use SQL server stored procedures and will access those stored procedures via LINQ. I am using stored procedures (again, for right or wrong) because I want to enforce security at the stored ...

LINQ 2 SQL : Loading more than one result sets to a variable when executing a stored procedure from LIN2 SQL.

In LINQ 2 SQL,I am executing a stored procedure like datacontext.StoredProcedureName(parameter1,paramter2) My sotored procedure is returning 2 different resultsets.How can i catch it and parse over it to grab the values from it VB.NET am working with ...

Oracle stored procedure DB Link question

I have a stored procedure FOO belonging to user A. User B has EXECUTE permission on FOO. One of the procedures in FOO uses a DB Link to retrieve data from BARTABLE@REMOTEDB. A has a DB Link to REMOTEDB connecting as user AREMOTE while B has a DBLink with the same name connecting to REMOTEDB but as user BREMOTE. When B executes FOO, w...

SQL query and stored procedure not producing desired results

I have this table and Stored proc function: Table: CREATE TABLE _DMigNumbers( Number numeric(20,0) NOT NULL PRIMARY KEY ); INSERT INTO _DMigNumbers VALUES(0) Stored proc function: CREATE FUNCTION read_and_increment() RETURNS NUMERIC(20,0) BEGIN DECLARE @number_just_read NUMERIC(20,0); SELECT number INTO @number_just_r...

How to execute a stored proc in C# the easy way?

Usually when I execute a stored proc from C# (ASP.NET 3.5), I have to do the following: myConnection.Open(); SqlCommand cmd = myConnection.CreateCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "myProc"; SqlParameter param1 = cmd.Parameters.Add("@param1", SqlDbType.VarChar); param1.Direction = ParameterDirec...

Running stored procedures

Hi, What's the best way to know which stored procedure are currently running in a database. I have a stored procedure which basically calls other 3 and passes them some parameters and these 3 stored procedures take a long time to complete... I would like to know which one is running... Thanks ...

SQL stored procedure where database to query is parameter

I am working with Microsoft Access (not SQL server) and have written a stored procedure (Query) as shown below in SQL. This procedure works but it relies on a hard coded path to the database from which to pull (SELECT) the data. To make the query more useful I want to pass the database to SELECT from as a parameter to the query - how d...

using stored procedure in hibernate 3

Hello I am using hibernate + spring since 5 months but never used stored procedure in hibernate so please can anybody tell me how to call stored procedure from DB(MySQL).... ...

Can I pass multiple rows from a stored procedure query into another query?

In my previous question I asked about storing the result of a query in a variable... now I realize the query can return multiple rows. I currently have this: SELECT @UserId = UserId FROM aspnet_Users WHERE UserName = @username And I want to do something like this: DELETE FROM some_table WHERE UserId IN ( *the ID list* ) DELETE FROM ...

SQL Server 2005 Stored Procedure Using Table Variable Doesn't Return ResultSet to VB6 App

I have a stored procedure which selects a single field from a single row (based on a conditional statement) and stores it in a local variable. Based on the value of this field I update the same field in the same row of the table (using the same conditional statement). So the procedure first does a select into a local variable and then ...