stored-procedures

Is LINQ slower than calling stored procedures?

I'm hoping that we will be overhauling our system to use ASP.NET MVC, however all of the examples provided tend to use LINQ to SQL. We were told by a LINQ developer than it is actually slower than calling a store procedure. Furthermore, how would you call a stored procedure for output using MVC? I'm not entirely sure LINQ would meet o...

Stored Procedure Multiple-Table Output With LINQ and ASP.NET MVC

Quite often our systems call stored procedures which output multiple tables worth of results. Previously we used XML outputs to get each table and relate them correctly using XSLT. If I were using ASP.NET MVC with LINQ calling a stored procedure, how do I get each of the tables and then output the data as necessary? ...

Using LINQ to SQL to read stored procedures.

Does anyone know a way to access the text of stored procedures using LINQ to SQL? I'd like to audit a set of stored procedures to check that they contain all contain some common code. It feels like there should be a nice way of opening them through a LINQ to SQL data context but I don't know how. Any suggestions? ...

How do I get identity from one sproc and pass it in to another sproc?

Hi all i'm looking for a way to pass in a generated id from a sproc to another sproc. i.e. @name varchar(12), @descript varchar(55) @test_date date, @test_result varchar(1) BEGIN EXEC ts_create_item @name, @descript END if (@test_date is not null) or (isnull(@test_result_id,'')!='') BEGIN Exec ts_update_test_results @itemid(gener...

Need good scheme/workflow for managing database objects using Subversion

How do you track/manage your stored procedures, views, and functions in SQL Server? I'd like to use Subversion, but it looks like I would have to just save & commit the CREATE/ALTER statements. That might work okay for me, but I suspect I'd end up doing a lot of nagging. Is anyone using versioning with their databases? Is there a bette...

Sane/fast method to pass variable parameter lists to SqlServer2008 stored procedure

A fairly comprehensive query of the brain has turned up a thousand and one ways to pass variable length parameter lists that involve such methods as: CLR based methods for parsing strings to lists of integers Table valued functions that require the presence of a 'Numbers' table (wtf?) Passing the data as XML Our requirements are to p...

Dynamically Populating an Oracle Cursor in a Stored Procedure

I need to dynamically populate an Oracle cursor (Oracle 10g). The SQL statement changes, based off of the input value to pull from different tables, and columns. What I don't want to do is have to maintain a temporary table that I truncate and load everytime the sproc is executed. Here is what I am currently doing, but if there is ano...

How do I write this code using SubSonic?

I have some legacy code that I'm rewriting using SubSonic to help the future maintainers. For the most part it's been relatively simple, as everything makes a stored procedure call. But now I'm having some difficulty with some tightly-coupled ADO.NET code. The code depends on the SqlDataAdapter to decide when to call an INSERT or UPDATE...

Weird SQL Server query problem

So I have this weird problem with an SQL Server stored procedure. Basically I have this long and complex procedure. Something like this: SELECT Table1.col1, Table2.col2, col3 FROM Table1 INNER JOIN Table2 Table2 INNER JOIN Table3 ----------------------- ----------------------- (Lots more joins) WHERE Table1.Col1 = db...

LinqToSql stored procedures always makes the paramters nullable. Why?

Hi folks, whenever i drag-n-drop a stored procedure onto my Context canvas, the parameters/arguments for the stored procedure are all nullable. Why is this? Is it because of how i've declared my parameters inside the stored procudure itself? Besides manually creating my stored procedure methods in the Context partial class (or drag-n-d...

How to do SELECT TOP @Param in a Stored Procedure?

I'm trying to do the following in a proc, but getting an incorrect syntax error: SELECT TOP @NumberOfResultsToReturn * What am I doing wrong here? Thanks. ...

PLS-00306: wrong number or types of arguments in call to...

Can anyone help me with this error. It works when I try the first procedure but not the second when I enter two numbers. Any ideas? create or replace package LE2_P1 is procedure GENERATE_MULTIPLICATION_TABLE(p_axis_both in number); procedure GENERATE_MUTLIPLICATION_TABLE(p_axis_x in number, p_axis_y in number); end LE2_P1; / create or ...

How do you export the content of stored procedures?

How can I export the content of a stored procedure using a SQL Statement? ...

Any good C# code generator for using oracle stored procedures?

I'm looking for a C# code generator which generate C# automatically to access stored procedures on Oracle Database. For instance, if I have some packages on schema DEV like: PACKAGE1 with FUNC1, FUN2 PACKAGE2 with FUNC3, FUN4 The generator creates code to run from C# the following code: int a = PACKAGE1.FUNC1(12, 34, "hello"); An...

What is the overhead associated with .NET stored procedures executing on Sql Server?

Certainly there is some type of context switching, marshaling, serializing, etc that takes place when you choose to write a stored procedure in NET vs T/SQL. Are there any hard facts about this overhead as it relates to making a decision about using .NET vs T/SQL for stored procedures? What factors do you use in order to make the decis...

How to create a UDF that takes a query string and returns the query's resultset

I want to create a stored procedure that takes a simple SELECT statement and return the resultset as a CSV string. So the basic idea is get the sql statement from user input, run it using EXEC(@stmt) and convert the resultset to text using cursors. However, as SQLServer doesn't allow: select * from storedprocedure(@sqlStmt) UDF with E...

Stored procedure paramters in SSRS double up

Working with SSRS and a SQL 2000 source, I have a stored procedure that takes three parameters and returns a result set. I have a dataset with the Command Type set to StoredProcedure and the procedure name in the Query String. When I attempt to execute the procedure in Visual Studio/BIDS, the Define Query Parameters dialog box presents w...

Is it okay if from within one stored procedure I call another one that sets a lower transaction isolation level?

I have a bunch of utility procedures that just check for some conditions in the database and return a flag result. These procedures are run with READ UNCOMMITTED isolation level, equivalent to WITH NOLOCK. I also have more complex procedures that are run with SERIALIZABLE isolation level. They also happen to have these same kind of chec...

Cannot execute stored procedure with ADO.NET Entity Framework

I've created a simple parameterless stored procedure which I've pasted below. I've imported the stored procedure to my Entity Model and created a Function Import. The function in the model is never created and I am unable to execute this stored procedure using the ADO.NET Entity Framework. I've opened the .edmx file in XML view and have ...

writing logic to store data in Mysql to store Metadata of Files

Hi Guys, Lemme explain the scenario: I need to fetch all the Metadata of Files, i.e., Title, author, subject.. and Custom Attributes.( Custom attributes are not fixed, they are not fixed and can be of any numbers). Now to Store this Struvture I have Designed a DB like : MainTable: FileID, FileName, Title, Author, Subject and To Store C...