stored-procedures

mulit value and stored procedures

I have looked at the other questions concerning Multi Value selection in reporting services and none of them fixed my issue. My issue is this. I have a report that has a query for the parameter - @Type. Select distinct(type) from TypeTable order by Type the report paramenter is set up and the report shows all the returned results (cu...

Performance Vs Principles , how much business logic should be there in the Stored Procedures

I always have debate with my Architect / DB team , on having a hybrid model to move partial business logic into the SP, like give the results based on few flags like Status , Date and logged-in USER ID ROLE( might also have some basic business logic) for a huge volume of DATA. If we can do this in SP then we could improve the performance...

How do you tell ASP .Net dynamic data to use stored procedures for select?

I see you can specify Insert, Update and Delete stored procs, but no straightforward way for SELECT stored procs. ...

MySql returning multiple rows from stored procedure / function

Hi, I need to make a stored procedure or function that returns a set of rows. I've noted that in a stored procedure i can SELECT * FROM table with success. If i fetch rows in a loop and SELECT something, something_other FROM table once per loop execution, I only get one single result. What I need to do is looping, doing some calculation...

Avoding unnecessary updates In Update Query

Hi, In our application,Many pages includes "update" and when we update a table,we update unnecessary columns,which dont change,too. i want to know that is there a way to avoid unnecessary column updates?We use stored procedures in .net 2003.In Following link,i found a solution but it is not for stored procedures. http://blogs.msdn....

Select data from a record collection type.

I have a stored proc in oracle 11g server that has an out variable of record. I cannot edit this procedure. I am creating a function that will call the procedure and return the information in the record set. I looked at the following question asked here: past question My Question is can I create a type of table for a record and query i...

How do I Open a Stored Procedure and Edit it in SQL*Plus

I need to make some changes to an old Oracle stored procedure on an obsolete box that is being kept around to run an old legacy process. The only tool I can connect to the db with is SQL*Plus. How do I load a stored proc into memory for editing in SQL*Plus? The tutorials I've found on-line don't exlain how that's done. :-( ...

Formatting RAISERROR messages in SYBASE ASE 12.5

In a stored procedure, I am trying to test if a parameter is null or less then 1, and if so, raise an error with a friendly message, and the value of the parameter. Here is my code: IF @ID IS NULL OR @ID <= 0 BEGIN RAISERROR 27001 'ID is ?????. ID cannot be null or less then zero.' RETURN 27001 END What I would like back is e...

What is the best code to call stored procedure with many parameters.

Hi fellows, I have realized that I have a very large method, which creates SqlParameter objects and adds them to SqlCommand (cmd). For instance: SqlParameter itemType = new SqlParameter { ParameterName = "ItemType", Direction = ParameterDirection.Input, SqlDbType = SqlDbType.Int, Value = (int)item.ItemType }; cmd.Param...

Default parameter values/optional parameters for .NET stored procedures in SQL Server 2005

SQL Server a stored procedure written in C# on the .NET 2.0 framework that has a SqlInt32 parameter. I am trying to make the parameter optional. Here is a minimal test case that just prints the integer passed to it: [Microsoft.SqlServer.Server.SqlProcedure] public static void TestProc( SqlInt32 TestInt ) { SqlPipe pipe; ...

Passing an array of parameters to Stored Procedure

I need to pass an array of "id's" to SP, delete all rows from the table EXCEPT the rows that match id's in the array. How can I do it in a most simple way? ...

How do I get data from a SubSonic stored procedure?

I have a stored procedure: CREATE PROCEDURE [dbo].[usp_SelectStuff] AS @param1 int @param2 int BEGIN SELECT [Stuff] FROM TABLE END I want to run this from SubSonic, and the use the stuff that has been selected. So I do: var db = DB.CreateDB(); var stuffProcedure = db.UspSelectStuff(0,1); Now how do I actually get the data from...

What indenting style do you use in SQL Server stored procedures?

None of my SQL Server stored procedure editing IDEs seem to have any tools to enforce indentation styles, so I find that a lot of the stored procedures I see are all over the place. I find indenting really improves readability though. I would like to codify some stored procedure indenting standards in our company's coding style guide, ...

How to use Stored Procedure in Inner Joins?

How to use stored procedure in inner joins? ...

How to call stored procedure in crystal reports using C#

Hi, I am able to create a crystal report for a single table call from C#.\ But I have to call generic stored procedure or a single stored procedure. How can I do this? Do we can acheive this using XML files also? I mean .. the details abt which table the SP is referring to and if I want to dump the data to excel sheet, which cells the...

LINQ Query or stored procedure to return max value in a stated column

Table like datetime a1 b1 x2 ... 07-01-2009 13:10 8 9 10 07-01-2009 13:11 8 8 2 07-01-2009 13:12 9 1 1 1 row per second for a whole day (=86400 rows); ~40 columns; all same format I'm looking for a way to retrieve a max value and the time for a column to specify. I'm looking for a way to...

How to compare values which may both be null is T-SQL

I want to make sure I'm not inserting a duplicate row into my table (e.g. only primary key different). All my field allow NULLS as I've decided null to mean "all values". Because of nulls, the following statement in my stored procedure can't work: IF EXISTS(SELECT * FROM MY_TABLE WHERE MY_FIELD1 = @IN_MY_FIELD1 AND MY_FIELD2 = @IN...

How can I dump a SELECT statement to the "Messages" pane in SQL Server mgmt studio from a stored procedure?

I can use the PRINT statement in a stored procedure to debug my code. I see the output in the Messages tab of SQL Server Management Studio. How can I dump one or more entire SELECT statement outputs to that Messages tab? My stored procedure returns several output variables so returning a single dataset isn't an option here. I am strug...

MySQL "inserts" speed difference between production and local environment is too big!

Hi, I have installed MySQL 5.1x instance on a Linux machine (768MB RAM). I restored a backup of about 1000 rows and through my .NET application (deployed on a different Windows webserver) I performed certain read operations, which, when considering that the table had no indexes, were fast. I then cleared the server from these rows and ...

Subsonic 3.0 SP parameter error

Hi I have a SP (shortened version): CREATE PROCEDURE [dbo].[usp_ADMIN_CountExposure] @whereAge int ,@whereGender int ,@whereSalary int AS BEGIN SET NOCOUNT ON; DECLARE @query varchar(max) SET @query = 'SELECT [ID], SUM([Lives]) AS [Lives] FROM [ExpDB].[dbo].[Ex...