stored-procedures

How to check the integrity of the storedprocedures

Hi, We have a large database containing a lot of stored procedures. Now we are updating our database but some stored procedures still use the old structure. We've found most of them using 'sp_depends' but some sp's slipped through. I was wondering if there isn't a way to check all stored procedures. If they call for a column that doesn...

Sybase stored proc called from isql on AIX: how to handle return code

I've got an AIX batch job that uses isql to execute a stored procedure in Sybase. The stored procedure is returning an error code under certain conditions. I would like for isql to pass that return code to the AIX script. Can I capture the the stored proc's return code within isql, or do I have to write an output file of some kind and h...

mysql query help (like statement)

I am using mysql which i have a stored procedure which has an input variable. I want to use this variable in a select statement (with like clause). Eg: DELIMITER $$ DROP PROCEDURE IF EXISTS `DeleteDataByTransactionID` $$ CREATE DEFINER=`root`@`%` PROCEDURE `DeleteDataByTransactionID`(in **$TransactionID** varchar(50)) BEGIN delete ...

Oracle stored procedure OUT parameters

Hi to all, I have a stored procedure with an IN OUT parameter declared like follows: create or replace PROCEDURE RIFATT_SEGN0_INS(pIdRifattSegn0 in OUT NUMBER, pNumDossier IN VARCHAR2 , pNumConsegna IN NUMBER, pDtConsegna IN DATE, [..] ) AS [..] Whene...

Random Behaviour of Load_File and Extract Function of MSQL 5.1

Hi Guys. I am Using Mysql 5.1 as a datastore. Here, I am having a lot of Data, So I have created a big XML File(max upto 1-GB Size), and I have Created a Procedure for Doing this, I m using few functios i.e., Declare XML BIGTEXT ; SET xml = LOAD_FILE(file_name); SET nrows = ExtractValue(xml, 'count(/.../row)') and same way ncols f...

Getting the application executable name from T-SQL stored procedure

From a stored procedure in SQL Server, is it possible to get the name of the executable (ie MyApp.exe) that owns the connection? I know there is APP_NAME(), but that appears to just return whatever string was passed into the 'Application Name' parameter in the connection string. If this is possible, how can it be done? Thanks. ...

Can subsonic build for me the CRUD and paging stored procedures?

Can subsonic help me building these main stored procedures? Can i edit its template to make it generate these SPs? Where to begin learning that? ...

Creating a trigger dynamic

I use MS SQL 2008 and I want to create a trigger in a database that is created dynamic. Creating the database is called within a stored procedure of an other database and runs perfectly, but when I want to add a trigger or a stored procedure, the executing fails. If I try to run the dynamiy SQL with an EXEC('USE dbase GO CREATE TRIGGE...

Stored procedure parses correctly but will not execute. Invalid object name. Msg 208

I've scripted up a stored procedure as follows. It will parse without errors, but when I try to execute it, it will fail. The error message reads: Msg 208, Level 16, State 6, Procedure aspnet_updateUser, Line 23 Invalid object name 'dbo.aspnet_updateUser'. Here is the stored procedure. USE [PMRS2] GO /****** Object: StoredProced...

StoredProcedures.cs emtpy

When I generate the DAL via SubCommander/sonic.exe I get an empty StoredProcedures.cs All that's in it is:using System; using System.Text; using System.Data; using System.Data.SqlClient; using System.Data.Common; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Configuration; using ...

How can you enable transactions with IBM.Data.DB2.iSeries for stored procedures

I am trying to write a client which executes a series of DB2 iSeries Stored procedures in DB2. I am using the IBM.Data.DB2.iSeries provider and need all my calls to be within a .NET transaction. Seems like everything is ignored and data being committed.Any pointers... ...

SQL string manipulation

I have a table that stores user information. The table has a userid (identity) column in it. The table data is queried by a view which is referenced by a lot of sprocs, but we reference something called auid which is created by the UDF below. The UDF is called in the view and sprocs then join or query from the view based on auid. It ...

Display parameter's value list of stored procedure

Hello, calling a stored procedure as int pageNumber = 1; int pageSize = 4; SubSonic.StoredProcedure sp = SPs.UspListPlants(pageNumber, pageSize); string result = sp.GetReader(); The sp work fine, but trying foreach (SubSonic.StoredProcedure.Parameter param in sp.Parameters) { sb.Append("'" + param.Name + "' = "); ...

Correct error-handling practices for the data-layer.

What are good things to check for, with respect to error-handling, when you are dealing with the data-access-layer? For example, let's assume I have this function.. Public Function UserExists(ByVal userName As String) As DataTable Dim dt As Object = Nothing Dim arSqlParameters(0) As SqlParameter arSqlParamet...

Execute SQL Server SSIS Package From Stored Procedure

I have a SSIS package that is stored in a SQL Server 2005 DB. I am trying to execute this package from a stored procedure on the same server. Is there a better way than exec master..xp_cmdshell 'dtexec /SQL... I am running into (I think) file system permission issues with xp_cmdshell that is preventing execution ...

SQL Server Replication - Adding a new stored procedure - How to get it to replicate?

I have a SQL Server 2005 Database which uses merge replication. I have added four new stored procedures on the publisher end, but they haven't replicated. The publication property "Subscription Options" - "Replicate schema changes" is set to True. How can I get easily get these tables replicated without having to send new snapshots to...

Text search in Stored Procedures in SQL Server 2005

How do I find a stored procedure containing a certain text? While I understand that the best place to do this kind of searching is through your source control tool, but are there ways to do this in the database? ...

SQL: No Identity feature workaround using triggers, Any Help?

I'm a little rusty with my triggers and what not and am trying to figure out this problem for a class: In a database TEST, tables do not have the option of the IDENTITY feature. In other words, when we insert a row into the table “Users”, we would like the primary key “UserID” to auto-increment. Please suggest a workaround to implement ...

stored procedure returns varchar

I would like to know if in SQL is it possible to return a varchar value from a stored procedure, most of the examples I have seen the return value is an int Example within a proc declare @ErrorMessage varchar(255) if @TestFlag = 0 set @ErrorMessage = 'Test' return @ErrorMessage ...

Retrieving auto-incremented column value from table where multiple insert/selects in single stored procedure

I have a stored procedure with multiple insert/select statements. Let's say I'm using the first insert to populate a "Manager" table. On insert, a ManagerId (incremented automatically) is added, but not referenced in the insert statement. I then wish to use the ManagerId from this table to insert a row into another table, where Manage...