stored-procedures

Cascading Delete / Update in LINQ-to-SQL class

Hi, I am not deleting records permanently (just maintaining flag) but I'd like to know how cascading delete / update works in LINQ-to-SQL class. EDIT If I have similar situation e.g. maintaining flag for Delete option. How do you achieve Cascading Delete for your database? ...

mysql java cant execute stored procedure

I am connecting to a mysql(5.08) db running on a linux machine from a web application running in tomcat. I get the following exception..when I try to execute a stored procedure.. com.hp.hpl.chaos.web.exception.DBException: getNextValue for operatorinstance[Additional Information from SQL Exception][SQLErrorCode: 0 SQLState: S1000 a...

Can LINQ to SQL and traditional Stored Procedures co-exist?

First, to be clear, I am not talking about LINQ to SPRocs. I have an existing DAL that uses over a 100 stored procedures. This was created when this program was a web app. Now it is a winform app in a sometimes connected environment that uses a local db. I have left the existing DAL in place in the interest of time but am now find...

grabbing first result set from a stored proc called from another stored proc

I have a SQL Server 2005 stored proc which returns two result sets which are different in schema. Another stored proc executes it as an Insert-Exec. However I need to insert the first result set, not the last one. What's a way to do this? I can create a new stored proc which is a copy of the first one which returns just the result set ...

Stored Proc returns a Cursor, how to handle this using OLEDB in C#

Hello, I am using OLEDB driver to call a Stored Procedure in Oracle DB. The Stored Proc returns a cursor as the output. I am able to call this Stored Proc using Oracle Data Source (System.Data.Oracle.OracleCommand), However I do not know how to call this SP using the OLEDB data source. Any help on how to specify the SP is returning a cur...

SQL Server: Output an XML field as tabular data using a stored procedure

I am using a table with an XML data field to store the audit trails of all other tables in the database. That means the same XML field has various XML information. For example my table has two records with XML data like this: 1st record: <client> <name>xyz</name> <ssn>432-54-4231</ssn> </client> 2nd record: <emp> <name>abc</...

Execute Immediate within a stored procedure keeps giving insufficient priviliges error

Here is the definition of the stored procedure: CREATE OR REPLACE PROCEDURE usp_dropTable(schema VARCHAR, tblToDrop VARCHAR) IS BEGIN DECLARE v_cnt NUMBER; BEGIN SELECT COUNT(*) INTO v_cnt FROM all_tables WHERE owner = schema AND table_name = tblToDrop; IF v_cnt > 0 THEN EXECUTE IMMEDIAT...

calling sprocs from a db layer in c#

suppose you have some simple sprocs eg AddXYZ(param1, param 2...etc) getAllXYZ() getXYZ(id) what is the "best practice" way of calling these sprocs from the "db layer" i don't want to use linq. just simple c# static methods on how to do this. im using sqlserver. ...

Help me out with this MySql cursor code

Trying to migrate from MSSQL to MySQL. This Stored Proc is creating a temp table for some columns from a permanent table then using a cursor to update each record's RandNum column with a random number and selects the dataset. As I'm writing this I thought that I could bypass the cursor and just... SELECT Id, Title, DateStart, Rand() FRO...

Is this a valid benefit of using embedded SQL over stored procedures?

Here's an argument for SPs that I haven't heard. Flamers, be gentle with the down tick, Since there is overhead associated with each trip to the database server, I would suggest that a POSSIBLE reason for placing your SQL in SPs over embedded code is that you are more insulated to change without taking a performance hit. For example. L...

Pros and Cons of massive table that controls all data flow with stored procs

DBA (with only 2 years of google for training) has created a massive data management table (108 columns and growing) containing all neccessary attribute for any data flow in the system. Well call this table BFT for short. Of these columns: 10 are for meta-data references. 15 are for data source and temporal tracking 1 instance of new/cu...

Catch and continue in SQLServer

I have this sql procedure: create procedure DELETE as DECLARE VARIABLES begin TRY DECLARE CURSOR FOR SELECT ANYTHING OPEN CURUPD FETCH NEXT FROM CURUPD INTO VARIABLES WHILE @@FETCH_STATUS = 0 BEGIN UPDATE TABLE BASED SON VARIABLES FETCH NEXT FROM CURUPD INTO VARIABLES END CLOSE CUR DEALLOCATE CUR end TRY begin catch DO NOT CARE ABO...

EXECUTE IMMEDIATE with USING clause giving errors

All, I am very new to stored procedures in general but I am struggling especially with those in Oracle. I have created a very simple example of what I am trying to accomplish and I am still getting the same error with this simplified version. The example stored procedure is as follows: CREATE OR REPLACE PROCEDURE ashish_test AUTHID C...

Since there is no Sqlserver array parameter, what's the best way to proceed?

I need to create multiple records in sqlserver, each with the same value in column A, but with a unique value in column B. I have the values for column B in an array. I am using VS2008, aspnet, c# 3.5, sqlserver 2005. Am I better off Option 1. Making 1 call to a stored procedure in sqlserver from c# code, and then doing all t...

MS SQL Server 2005 - Stored Procedure "Spontaneously Breaks"

A client has reported repeated instances of Very strange behaviour when executing a stored procedure. They have code which runs off a cached transposition of a volatile dataset. A stored proc was written to reprocess the dataset on demand if: 1. The dataset had changed since the last reprocessing 2. The datset has been unchanged for 5 ...

Steps to take to slowly integrate unit-testing into a project

I'm currently on a co-op term working on a project nearing completion with one other co-op student. Since this project has been passed down from co-op to co-op, poor practices have been taken along the way and testing has been left until the end. I've decided I'd like to write unit-tests to learn something new while testing. However, ...

Sql Server 2005 executing exe on remote machine or connect to server application

Hello, I'm try to figure how to create sql server stored procedure that when a condition is met executes an executable, with command line arguments, on a remote machine within the network. I could write my own little server application to handle the communication sent from the stored procedure for the executable, but I'm not certain ...

LINQ to SQL with stored procedures and user defined table type parameter

I am using LINQ to SQL with stored procedures in SQL Server 2008. Everything work well except one problem. L2S cannot generate the method for the stored procedure with user defined table type as parameter. Method signature in dbml design panel use object for parameter type instead of table type and when I tried to compile I got error: ...

Sql Stored Procedure With a Lot of Parameters

I am using Sql Server 2008. My Stored Procedure accepts almost 150 parameters. Is there anything wrong with that performance-wise? ...

Are SQL stored procedures secure?

Are they less vulnerable to SQL injection than doing stuff like mysql_query("SELECT important_data FROM users WHERE password = $password")? ...