stored-procedures

Stored Procedure via Notes Java Agent

Hello, I am trying to get a stored procedure to be able to be called from a java agent in Lotus Notes. I have been able to get these type(s) of agents to work fine as far as moving data to and from db2 tables, and I have also been able to run the stored procedure from Iseries Navigator using the same username/password that I am using fo...

Calling a Sybase stored procedure from another stored procedure ...

Hi, I'm calling a Sybase Stored Proc X that returns data that is used by a servlet. Within Stored Proc X, Stored Proc get_business_day is called in the following manner: exec get_business_day @CBDate, -1, @prevBusDay output So, the result of calling this (in DBArtisan) is: 6/25/2010 12:00:00.000 AM 1 row(s) affected. The iss...

Problem Setting Variable value in MySQL Procedure

Having trouble setting the value of a declared variable in MySQL. If I run the following in MySQL Command Line it all works great: SET @numberOfMonths = (SELECT COUNT(\*) FROM (SELECT DISTINCT months WHERE year = 2010) as A); SELECT @numberOfMonths; So it returns 6 for this particular example. If I do the following I don't have ...

How to stop stored procs from whining about a missing column that I am about to delete in SQL Server 2008?

Hi all, I am deleting a column from one of the frequently used tables in my database. Last time I did this errors started to crawl up from all sorts of stored procs that I had long forgotten existed; complaining about the missing column. (only when that stored proc was called) so, I dont want to get winded up with these things again,...

Problem in cyrstal report

When I try to view the Report this Error message appears, Crystal Report Viewer Failed to open a rowset. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for SQL Server Description: Warning: Null value is eliminated by an aggregate or other SET operation. SQL State: 01003 Native Error: OK Note:I connect Direct to sotr...

Error with calling stored procedure from C#

I have the following c# code to call stored procedure testproc, but when i run this application it displays saying that could not find stored procedure testproc, do i need to make any changes in syntax to call stored procedure. This is my c# code behind to call stored procedure SqlConnection con = new SqlConnection(); con.ConnectionStri...

Getting the parameter values being passed to SQL database via SQLDataSource control

I am debugging code written by a previous developer :-) I have a SQLDataSource control that is calling a database stored procedure, and passing quite a large number of paramaters, and the stored proc returns records that populates a gridview control. When I walk through the code behind to determine the values being passed, is ther...

Is it better to delete or declare new temp tables for SQL Stored Procedures?

I have a stored procedure with a few steps. Two of the steps require the use of a DECLARE TABLE but I do not require these tables at the same time. The tables both have 2 BIGINT columns and may have up to 100 rows. Is it better practice to declare the two tables or to DELETE and re-use one? EDIT: If you're interested, this is a follow...

How do you use DROP TABLE IF EXISTS in a mySQL Stored Procedure?

I'm writing a rather long mySQL Stored Procedure that will do a bunch of work and then load up a temp table with the results. I've seen a few ways to do the temp table thing. Basically, you either create the temp table, work on it, and then drop it at the end ... or you drop it if it exists, create it, and then do your work on it. I ...

Call stored procedure through nhibernate

I need to call a stored procedure through nhibernate. But I did not know it make. I have simple stored procedure: CREATE PROCEDURE InsertDoc @Name nvarchar(50), @Author nvarchar(50), @Link nvarchar(50) AS INSERT INTO documents(name, date, author, doclink) VALUES(@Name, CURRENT_TIMESTAMP, @Author, @Link) I do th...

apply best fitted discount package on items automatically

I have created some discount packages: Package1(Item1,Item2,Item5) Discount-5%. Package2(Item2,Item5,Item8) Discount-8% Package3(Item1,Item2) Discount3%. When a Person buy Items Online(for Ex. he buys Item1,Item2,Item5, Item10), while I show him the total price, I need to apply the best fitted discount on the items automatically. I...

SQL Server 2008 and COM server programming

Hi, We need to access a custom ATL COM server from SQL server 2008. Ideally we want the COM server to live on a separate machine since it is part of a larger software application. I know of the COM/OLE automation stored procedures that SQL provides (sp_OAXXXX) but they don't seem to accept a computer/server name for remote invocation. ...

Is there significant overhead for PRINT statements in SQL Server 2005 Stored Procedures?

I noticed in a code review that one developer added PRINT statements throughout many SQL Server stored procedures. These stored procedures are executed from a ASP.NET website, using SqlClient. Is there any performance penalty to having these PRINT statement in the code? Or will they automatically be skipped when the procs are called fr...

Execute SQL Task on SSIS 2005. ADO.NET connection type and Stored Procedure Input Parameter. Not working. Syntax error

I am Execute SQL Task on SSIS 2005. ADO.NET connection type and Stored Procedure Input Parameter. Not working. Syntax error I read some documentation and blogs but its not working for me. This is what I have on SQL Statement of the Exeute sql task (ADO.NET) EXEC StoredProcedureName @ParameterName = It gives different errors on d...

How to call oracle stored procedure which include user-defined type in java?

In Oracle DB: Store Procedure like: procedure getInfo ( p_ids IN IDS_TABLE, p_details OUT cursor ) Type IDS_TABLE is: create or replace type IDS_TABLE as table of IDS create or replace type IDS as object ( id1 NUMBER, id2 NUMBER, id3 NUMBER ) How can I call getInfo in Java? ...

Determining if MySQL table index exists before creating

Our system's automated database migration process involves running .sql scripts containing new table definitions and their accompanying indexes. I require the ability to create these tables and indexes only if they don't already exist. Tables are taken care of by using IF NOT EXISTS but no such syntax exists when creating indexes. I've...

Perl DBI with mysql: how to get return value from a stored procedure?

Does DBD::mysql implement the bind_param_inout method? I am getting the following error messages when trying it out: DBD::mysql::st bind_param_inout failed: Output parameters not implemented [for Statement "call spCreateTransactionRecord(?, ?)" with ParamValues: 0=Null!, 1=Null!] at ./db.pl line 23 My code: #!/usr/bin/pe...

SQL Error: Incorrect syntax near the keyword 'End'

Hi Need help with this SQL Server 2000 procedure. The problem is made difficult because I'm testing procedure via Oracle SQL Developer. I'm running the procedure to iterate column with new sequence of numbers in Varchar format for those who have null values. But I keep getting error, so a) I may have done a wrong approach b) syntax i...

Object must implement IConvertible?

Getting this after solving a "Error converting data type nvarchar to datetime" error. Using Vb.net/SQL Server 2000 updating a row via a gridview/sqldatasource: Stored Procedure: @ISTag varchar(10), @PCISTag varchar(10), @User varchar(50), @Date_Start datetime, @Date_End datetime, @Status varchar(50), @Cost money, @Notes varchar(500), @...

Sybase CURSOR UPDATE extremeley slow / locking up

I have a temp table with 13,000 rows. Most of the rows have a numeric price (100) but some are quoted in 32nds, i.e. 100-30 = 100 + 30/32 = 100.9375. (Some even have fractions of a 32th) I am opening a cursor FOR UPDATE and iterating over the temp table. It takes so long to execute, I am not even sure it is working (my DBA says the exec...