stored-procedures

Loading DataTable into SP

I have SQL Server 2008 and VS 2008 Pro. And I am coding in C#. I accept a text input file from the customer and I parse this data into a DataTable in my C# aspx.cs file. I know that this is working correctly. So I populated the DataTable. But now how do I load this data into an SP? Like can I use a dynamic table parameter? Or shou...

Dear DBA - I want to use LinqToSQL instead of stored procedures because...

In my organization we have to answer to a separate DBA group for decisions like using LinqToSQL . What do you see as some of the best reasons for using L2S rather than stored procedures. ...

ASP code to execute Stored Proc

I am getting error trying to run my asp code for executing stored proc. my code is: Set conn = server.createobject("ADODB.connection") conn.open Set rs = server.createobject("ADODB.recordset") strSQL = "exec spActiveEmployee" rs.open strSQL, conn, 3, 3 I am getting an error that says: - "Either BOF or EOF is True or the current reco...

Stored Proc that has output values

Hello, I am new to TSQL. I need to create a stored proc that will return records (more than one record). I would like to return back AccountID, FirstName, LastName & email. For example, I am comparing two tables using the AccountID fields. So currently my query is: Select AccountID, FirstName, LastName, email from tblCustomers Where Ac...

Crystal Reports XI and MySQL Stored Procedure with Parameters

I am having a problem with a Crystal Report that displays data from a MySQL table. I am currently gathering the data directly from the table, however when the users try to input parameters, problems arise such as: null values for parameters returning errors parameters not working as specified I then created a stored procedure to re...

Is saving one control's value to the database better than saving all controls?

I came across this a few times in my career and never really found an answer. My question is in regards to a web form that contains multiple controls that the user can update, and then saves the data to a database (easiest example I can think of right now is a user profile form - see SO profile edit screen). So far, I have always just s...

mysql stored proc

hi all how can i execute a stored proc in mysql db? i have to pass parameters and to catch the result out off stored proc. ...

How to Filter variables for SP, to return only one value from many in SQL View

Hi , In a SQL View, I have 5 boolean variables and one int variable. out of 5 boolean variables only one variable will be true for a single data row, Task Type boolVerySmall Datestart TagName Architecture Setup -- Doc Code True 1900-01-01 00:00:00.000 Design_09 idProject boolsmall boolM...

How can I capture a SQL Stored Procedure Error triggered by RAISEERROR() in .asmx file?

I'm very new to .NET. All I've done so far is implement some SQL Stored Procedure calls as WebServices by copying and pasting existing code (as instructed by my superior). I am calling some commands via Database.ExecuteNonQuery(). In the SQL Stored Procedure, I am performing some security checks based on the LoginId passed in (a user ca...

Access 2007 triggers and procedures equivalents?

Ok, does anyone have some good resources for Access 2007 features regarding triggers or stored procedures? Can it even do them or something similar to them? Every resource I have found on Microsoft’s help is referencing back to Access 2003, as well as many of the help manuals online. Everything is moved around in 2007, so it is a littl...

How to know which stored procedures are running in an Oracle database?

I need to know which stored procedures are running. It's not an option to "mark" the stored procedures changing their source. Thank you very much. ...

What to use in SQL instead of a "Foreach" loop

I'm trying to write a stored procedure in SQL that will : Make a select query from table1 that will return multiple values Insert new values in table2 (1 new record in table2 for each record returned by the select on table1). I would use a foreach in C# but I know that SQL doesn't work that way. What's the correct way of doing this? T...

How to implement a conditional Upsert stored procedure?

I'm trying to implement your basic UPSERT functionality, but with a twist: sometimes I don't want to actually update an existing row. Essentially I'm trying to synchronize some data between different repositories, and an Upsert function seemed like the way to go. So based largely on Sam Saffron's answer to this question, as well as som...

Sybase ASE: "Your server command encountered a deadlock situation"

Hello, When running a stored procedure (from a .NET application) that does an INSERT and an UPDATE, I sometimes (but not that often, really) and randomly get this error: ERROR [40001] [DataDirect][ODBC Sybase Wire Protocol driver][SQL Server]Your server command (family id #0, process id #46) encountered a deadlock situation. Please ...

Stored procedure for everything

I had a heated discussion with a colleague on the usage of stored procedures (SP) in a .NET application (on an SQL server 2005 database). [He has a Microsoft background and I Java - which may or may not be relevant]. I have to insert data captured in the UI. For this I would write a SP and use that in the .NET code? It's not required b...

What is the best way to refactor database procedures?

I need to understand and clarify some T-SQL stored procedures that contain important business logic. Does anyone know of any tools, tips, tricks, or hints that can be used for unit testing so I can refactor this sql without breaking it? ...

MySQL - Disabling the query output and showing only the total execution time taken

I have a stored procedure which I want to test for speed in a production environment. So I created a new stored procedure which calls this for a 100 times, each time with different parameters. My question is: how can I disable the output that the MySQL command line prints as I am sure that this adds to the total time. So, to recap, from ...

Mac OSX MySQL Update Stored Procedure

Good afternoon, I am attempting to run a stored procedure that updates records in MySQL 5.1 on Mac OSX 10.4.11. Here is a sample procedure: DELIMITER $$ CREATE DEFINER=`root`@`localhost` PROCEDURE `TestUpd`() BEGIN UPDATE Addr SET eMail2 = 'test'; END $$ When I execute this procedure, I get the error, 'Error executing SQL ...

How to find data table column reference in stored procedures

I have changed a column name in a table in my SQL Server 2005 database. I also have a rather large collection of stored procedures that may or may not be referencing that column. Is there a way to find what stored procedures are referencing that column without actually going through each stored procedure and search for it manually? Is...

mysql stored-procedure: out parameter

Hello, I am learnig how to use mysql procedures (google book) and one example goes as: DELIMITER $$ DROP PROCEDURE IF EXISTS my_sqrt$$ CREATE PROCEDURE my_sqrt(input_number INT, OUT out_number FLOAT) BEGIN SET out_number=SQRT(input_number); END$$ DELIMITER ; Which compiles fine... (I am using mySQL Query Browser in ubuntu). But,...