stored-procedures

SubSonic 3.0 StoreProcedure Generation

When using SubSonic 3.0.0.3 and the StoredProcedures.tt template, the generated code won't compile and gives an error of: ... 'DB' does not contain a definition for 'Provider' ... This is in the calling method for the sproc. StoredProcedure sp = new StoredProcedure("Company_Get", this.Provider); Am I missing something or is the...

Execute a stored procedure from a windows form asynchronously and then disconnect?

Hi All, using a C# 3.5 Windows form, I am calling a stored procedure that can take 30 minutes to execute (please no knocks or debate on that...it’s doing a lot to a lot of data and is fully optimized). I don't want to make my user leave the app open for that entire time period, so I would like to call the sproc, let it fly and let them ...

SQL Server 2005 native stored procedures

Hello, Can i write a C or native C++ stored procedures for SQL Server? Thanks. ...

metaprogramming with stored procedures?

This is going to be both a direct question and a discussion point. I'll ask the direct question first: Can a stored procedure create another stored procedure dynamically? (Personally I'm interested in SQL Server 2008, but in the interests of wider discussion will leave it open) Now to the reason I'm asking. Briefly (you can read more e...

PostgreSQL socket connection

Is it possible to send data on a socket over a TCP?IP connection from a PostgreSQL stored procedure or trigger? If you know of any useful examples pleas tell me. If you know of something similar for other data base systems it would also be helpful. Thanks in advance. ...

Commitment control error on iSeries procedure call

I have an intermittent problem when calling an iSeries stored procedure (consisting of various CL & RPG programs). The error is:- Commitment definition *N not valid for open of QAOSSI12 Error occurred while opening file QAOSSI12. As mentioned the problem does not always occur but occurs more when load testing the procedure. I kn...

How can I automatically prepend comment blocks to SQL Server stored procedures?

In my organization, the standard is to comment all stored procedures with a comment block that looks like this: /*-- ============================================= -- Created by: Chris McCall -- Created date: 08.05.2009 -- Purpose: Inserts new setting value, code and description -- Modifications: -- <Date> <Programmer> <Change> -- ======...

MySQL INSERT INTO ... SELECT #1054 ERROR

Can anybody please help.. SELECT on its own works INSERT on its own with VALUES works also. note: products_similar has 2 columns VARCHARS get_cheaper() - stored routine returning VARCHAR I never ever had problems with INSERT INTO ... SELECT. But when I combine them I get error below: SQL query: Documentation INSERT INTO `produ...

Stored function in MySQL doesn't like user supplied dates?

I have a stored function in MySQL: CREATE FUNCTION `login_count`(o INT, start_date DATE, end_date DATE) RETURNS INT READS SQL DATA BEGIN DECLARE total_count INT; SELECT COUNT(*) INTO total_count FROM logins as l WHERE `order_id` = o && modified BETWEEN start_date AND end_date; RETURN total_count; END Pretty basic, takes an id, start...

Seeking Modularity In SQL Server 2005 - Returning Multiple Recordsets To A Stored Procedure

Hi, I've had this problem a few times and solved it the same way. But it's not pretty and I was wondering if anyone knew of anything a bit more elegant... The Basic Aim: - I have a piece of code that is common through-out many Stored Procedures. - For maintenance purposes I like modularity. - So I want to put that common code in it's o...

Pass Function value to Stored Procedure in MS SQL

I have a Function called dbo.GetFoo(). I also have a unit-testing Stored Procedure called AssertEqual (which takes @TargetValue sql_variant, @ExpectedValue sql_variant, and @Message varchar) I want to call GetFoo() and check to see if it's returning the right value 'X'. My T-SQL statement is: exec AssertEqual dbo.GetObjectType(), 'S', ...

Version changes for Stored Procedures

I have an application that relies very heavily on stored procedures (SQL 2005/2008). We are doing a minor update that will modify 25-35 of these stored procedures. The application is such that both versions of the stored procedure must be available. This is major version 4 of the application and usually we've been able to completely m...

mysql stored procedure editor

hi all, i want to know what is the best GUI or editor for working with stored procedures in mysql. i used to use toad but it is full of bugs specially in a network environment. ...

How can I use this T-SQL query in LINQ / Entity Framework?

I'm only dealing with one database table / entity object: NodePath. Given a particular Node, I want to get only a subset of all its NodePaths according to this query: select * from NodePath where NodeId = @GivenNodeId and Id in ( --active paths select a.Id from NodePa...

Delphi: How to get the value of an output parameter of a stored procedure?

I want to programatically create a SQLDataSet in Delphi and use it to execute a Stored Procedure and get the value of an output parameter. Looks easy but I can't make it work. Here is a dumb stored procedure in SQL Server: CREATE PROCEDURE [dbo].getValue @x INT OUTPUT AS BEGIN SET @x = 10; END Now here is one of the variations tha...

Extended Stored Procedure with ODBC DSN

I have an extended stored procedure (written in Delphi if that makes any difference) that makes its own connection via ODBC and performs some processing - stuff that can't be done using T-SQL alone. If I try to connect using the System DSN that is set up (e.g. named MyDataSource), the xp returns the following error: [Microsoft][ODBC SQ...

read output stored procedure that returns multiple recordsets in sql 2005

I'm trying to programmatically access the result of executing the system stored procedure sp_spaceused. if you pass the name of an object as a parameter, the sp returns a recordset which you can read like this CREATE TABLE #TempTable ( [Table_Name] varchar(50), Row_Count int, Table_Size varchar(50), Data_Space_Used var...

SQL Server output parameter issue

I am using SQL Server 2008 Enterprise. I am learning OUTPUT parameter of SQL Server stored procedure. For example, stored procedure sp_add_jobschedule has an OUTPUT parameter called schedule_id. http://msdn.microsoft.com/en-us/library/ms366342.aspx My confusion is, looks like OUTPUT parameter could be provided an input value and also r...

SQL Views and Sprocs

I've made it a company policy that all data access has to be done via Sprocs. That includes Selects, Updates, Deletes and Inserts. We're starting to become overrun by them. Am I overkilling it? The selects are being executed, and the results dumped into a custom DAL. I have a feeling that this is a holy war kind of question. I'm ...

Combining INSERT and UPDATE statement (SQL2005 Stored Procedure)

Hi, I need to extract records from a table, copy the data to a second table and then update the records in the first table to indicate that they have been copied across successfully. My current SP code is this: SELECT TBL_ADDRESSBOOKADDRESSES.* FROM TBL_ADDRESSBOOKADDRESSES INNER JOIN TBL_CAMPAIGNS ON TBL_ADDRESSBOOKADDRESSES.adds_AB...