stored-procedures

SQL SSRS Object has been disconnected or does not exist at the server

I have a couple stored procedures that run for about 2-3 minutes a piece (lots of data). When I run the stored procedures inside SQL Server Management Studio, the queries run fine and return the appropriate data, however, when I run my SSRS Report, it errors out with "Object has been disconnected or does not exist at the server." Any su...

SQL Best Practices

Is it good to check that some fields are blank or not from a table and return true or false from a sp Or is it good to fetch the values and check in the code. ...

Return base class in LINQ for stored procedure causes stackoverflow

I have quite complex SP which returns base class (basecontent). I have inheritence with about 30+ child classes (like "page", "news", etc). When I return other types from SP everything works fine, but this one drives me crazy. I am quite experienced with LINQ and already tryied to recreate SP, verified outout, etc. But this call fails ...

Configure Elmah to use existing stored procedure/tables

Hi, We have a system that already has a table and some stored procedures used for logging (Oracle). I am currently working on another system which is going to use the same database, but does not have a system for logging errors yet. I read that Elmah was an easy to use system, and have tried to set it up, but it seems that it by defaul...

Transaction Stored Procedure C#

Hi All, I am having a slight issue. Please guide me. I am coding in C#(Console App). I have called 2 different stored procedure in my code. Basically both these stored procedures access the same table. First SP has a select query and an update query. Second SP has a single update query. Now I want to call these SP in a transaction mode(...

Dynamic Pivot (in SQL Server 2005)

I'm writing a stored procedure for Microsoft SQL 2005 and I want to create a dynamic SQL Pivot: SELECT Book.ISBN, Book.Name StockMutation.StockLocation FROM Book INNER JOIN StockMutation AS sm ON Book.bookid = sm.bookid PIVOT ( COUNT(sm.NumberOfBooks) FOR sm.StockLocation IN (...) ) Preferable I want to r...

create three stored procedures (select/update/insert) per table or as needed?

using asp.net, sql server 2008, winserver2003 we have about 10 tables with about 20 fields each... we have about 30 web forms where each form uses some variation of fields from some/all tables... each form has its' own dataset depending on the tables it uses. However, to create that dataset, a Select * stored procedure is called on e...

Asynchronous Storec Proc without waiting for completion.

I have a client application that scrapes data into a raw table. This client application makes an asynchronous call to a stored procedure that actually parses the raw data into tables. This processing is handled by a stored procedure. That stored procedure can take up to a half hour to run. We want the client application calling the store...

Debugging ASP Stored Procedure Calls

I'm using the following code block to call a SQL Server 2005 stored procedure. The problem is the call will intermittently fail. How can I obtain more verbose information about the case of the failure. I've tested the SP with the failing input and found no issues. This would seems to indicate an error on the ASP side. Set rsOrderItems =...

Stored Procedure(s) slow on initial execution

Group, I am still learning SQL, and I am running into a new problem. I have a couple stored procedures that are slow on their initial execution/connection. For example, I have a stored procedure (sp) that I use in an application to look up prices for a product. The first time I run the sp in the morning it may take 20-40 seconds to ex...

Stored procedure execution problem

Iam implementing entity spaces in C# application and was able to execute queries such as the below one successfully. coll.query.where(coll.prodlineid.equal("id") if( coll.query.load()) However I need to replace all these queries in the code with Stored procedures. For this I used: coll.Load(esQuerytype.storedprocedure, "testproc", para...

How do I profile stored procedures on Oracle?

There is an Oracle DB to which I have access. I can view its packages using Aqua Data Studio and make queries to it. I don't have any access to the filesystem of the server. There is also a binary that uses that database by calling stored procedures from it. I want to know which stored procedures and with what parameters are used by th...

using visio 2007, how do I represent a trigger and a stored procedure?

I have a web service class diagram, I want it to show what stored procedures a web method calls. for now, I just use a class with a metod inside to represent a stored procedure, something like storeStuff(in this, in that, out field1, out field2) but this consumes tons of space, any tips? or are there any better ways to do this? tha...

Frustrating MySQL CREATE PROCEDURE error

Hopefully this is a nice quick one to resolve. Here is my .sql file: USE my_db; DELIMITER $$ CREATE PROCEDURE searchLocation(IN argQuery VARCHAR(32), IN argLimit INT) BEGIN SELECT DISTINCT `suburb`, `postcode` FROM `location` WHERE `suburb` LIKE '%argQuery%' OR `postcode` LIKE 'argQuery%' LIMIT argLimit ; END $$ DELIMITER ...

SQL server SP : @Param 's with sometime NULL values

I am very new to SQL Server Stored Procedures, I am trying to create a SP that will give return a list of records in a table by filter via StartDate and EndDate , but there will be 'View All' Option so sometime those @Param might not contain any values. Currently my SP is Like CREATE PROCEDURE [dbo].[spGetBonusRun] ( @StartDate as DA...

LINQ variable to list of string without using column names?

In an C# ASP.Net MVC project, I'm trying to make a List<string> from a LINQ variable. Now this might be a pretty basic thing, but I just cannot get that to work without using the actual column names for the data in that variable. The thing is that in the interests of trying to make the program as dynamic as possible, I'm leaving it up t...

SQL Server Transactions --- C#

Hi All, I need a help. Let me first explain the scenario with a small sample. Suppose I have a Students table with columns: Id int(PK) Name varchar(200) Marks1 int Marks2 int Marks3 int TotalMarks int IsTotalCalculated bit InProcess bit This table has huge number of records. Now, I want to calculate the TotalMarks...

SQL Server relationships buried in stored procedures rather than schema

At present we have very little referential integrity, as well as having a number of tables that self-join (and indeed would perhaps better be represented as separate tables or views that joined). The knowledge of how these tables relate to each other is implicit in the logic of the stored procedures rather than explicit in the schema. W...

do you see any problem with that stored procedure template?

so I created that(I used some stuff found on other website) to handle transactions and having a sort of stacktrace while executing stored procedure that could call other stored procedure that need transaction and etc. so if I have A calling B and B is calling C and C got an error, I can correctly rollback my stuff and returning a stackt...

NHibernate Populating Child Collection from Stored Procedure

I have an entity class that looks like : public class MyEntity { public virtual int Id { get; set; } public virtual ICollection<MyOtherEntity> MyOtherEntities { get; set; } } I have a stored procedure in my database that returns MyEntity objects joined with MyOtherEntity objects. I'd like to map this like: <sql-query name="My...