stored-procedures

redeploying a .NET assembly that contains CLR stored procedures

I have written a CLR stored procedure that is in an assembly. I have a build system that can auto-build and deploy .net application from our source control repository. I want the two things to work together so I can redeploy the assembly that hosts the CLR stored proc. However it looks like, unlike IIS, simply replacing the binaries ...

How to execute SubSonic3 StoredProcedure with return value

How do I execute a SP and get the return value. The below code always returns null object. The storedprocedure has been tested in the database using the same parameters as in code, but the SubSonic sp always returns null. When executed in the db via sql, it returns the correct values. This is using SubSonic 3.0.0.3. myDB db = new myDB(...

SQL Server SELECT INTO and Blocking With Temp Tables

So, recently a DBA is trying to tell us that we cannot use the syntax of SELECT X, Y, Z INTO #MyTable FROM YourTable To create temporary tables in our environment, because that syntax causes a lock on TempDB for the duration of the stored procedure executing. Now, I've found a number of things that detail how temporary tables work, s...

How to call MySQL Stored Procedure from SQL Server 2000?

I have two databases, one MySQL 5, one SQL Server 2000. I've got the MySQL database mapped as a linked server in the MS SQL database. I'd like to call a stored procedure saved in the MySQL database from the MS SQL database. What's the correct syntax to do this? Is it even possible in SQL Server 2000? Edit: I've tried EXEC webpush......

How can I use a stored procedure in a MySql database with Zend Framework?

I'm recently have learned to use Zend Framework. I did a simple CRUD application. But now I want to use a existing database for a more complex application and I want to know how I call a stored procedure in the Model, how to send parameters, how to read the results and store them in an array in PHP. Please. I appreciate any kind of help ...

c# return resultset from Oracle store procedure and fill a DataTable

I'm a c# SQL Server developer new to Oracle programming. The code below works for setting cmdText to: "select * from myTable". I'd like to now put this in a stored procedure, I need help with how to write this Oracle stored procedure and get the results into a DataTable in my c# code. Thanks. Code: private DbProviderFactory DbFactory ...

SQL Statement help required. Thanks.

UPDATE Finally managed to work it out! Thanks for all the help from everyone. If you spot any potential errors or scope for improvement in my query please let me know. SELECT * FROM TBL_CAMPAIGNS C INNER JOIN TBL_MEMBERS M ON C.campaign_MemberId = M.members_Id INNER JOIN TBL_CAMPAIGNS_CHARITIES CC ON C.campaign_Key = CC.camcha...

Linq to Entities - Retrieve entity with "self-reference" from Stored Procedure

I can't quite figure this out. I have a table called Employee with and Id field. The table also contains a ManagerId field which has a foreign key pointing to the Employee's Id field. When I add the table as an entity to my entity data model it creates the new Employee entity with an EmployeeChildren collection element and an EmployeePar...

Deleting a stored procedure in SQL server

Before I delete/replace a stored procedure, I would usually do a string search of the name of the stored procedure in the working project to make sure no unsuspecting code is using it. Is there a better and more reliable way of doing this? Oh and the code is in c# and i'm using vs2008 ...

sproc execution far slower than SQL ad-hoc query equivalent

I have a sproc that was taking far more time than I expected. I pulled out the SQL and ran it with just DECLARED variables for the parameters. It ran nearly instantaneously (versus a reliable 8 seconds with the sproc). This is the same SQL on same machine, returning the same data. How can I figure out and fix what is causing the spro...

SP return null as ZERO ?

Using a stored procedure i have a fairly complex SQL statement which returns a COUNT value as a pseudo column. In many cases the result will be 'null'. This causes problems in my application, so i am wondering if it is possible to return a 'null' as '0' by default from the stored procedure? Thanks. UPDATE I need to apply the ISNULL to...

How to build a mapping file for an insert stored procedure using NHibernate 2.1

I'm looking for a way to map a simple insert stored procedure using NHibernate 2.1 Most of the examples I find are for getting data back from a sproc - but what I'm trying to do is insert an audit like record using a stored procedure. But I would prefer to build a mapping file for this Also - to be clear I'm not looking to build an en...

Why some stored procedures do not return data in ASP.Net C#

What I tried to do is generating a text file on ASP.Net using C#. The data is retrived from a database by executing a stored procedure. I ensured that the stored procedures returned values by executing it in SQL server Mangement studio. I was actually able to do just that. I first gether all related tables into a View then using stored ...

How do I navigate related entities from a stored procedure that is mapped to an entity

I have a complicated full-text search stored procedure that i have mapped to return an entity type. It won't allow me navigate the references in the result though: using (MyEntities kb = new MyEntities()) { var results = from customer in kb.SearchCustomers("blabla") select new { CustomerName = customer.LastName + "...

How do I avoid dynamic SQL when using an undetermined number of parameters?

I have a StackOverflow-like tagging system for a database I'm working on. And I'm writing a stored procedure that looks for results based on an undetermined number of tags in a WHERE clause. There could be anywhere between 0 and 10 tags to filter results. So for example the user could be searching for items tagged with 'apple', 'orang...

Calling StoredProcedure in Subsonic throws Error

I setup a simple select SP to return some rows use the templates to generate the StoredProcedures.cs file and then attempt to call the SP and get a Dataset back; SubSonic.Schema.StoredProcedure sp = GetSPData(userID); var data = sp.ExecuteDataSet().Tables[0]; The errror I receive is this: The SelectCommand property has not been initi...

Mysql Stored Procedure Issue

When creating the following procedure I receive this error message: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'd_query; set d_result = execute stmt; deallocate prepare stmt; ' at line 15 But after checking I can't see the ...

Oracle Date field - Time issues

We have two databases, in two separate locations. One of the databases resides in a separate time zone than our users. The problem is that when the database that is located in a separate time zone is updated, with a Date value, the database automatically subtracts 1:00 hour from the Date it was passed. The issue is that, when passing ...

How do pass in a limit to a query run inside a mysql 5 stored procedure?

Here's a sample of what I'd like to do. The stored procedure fails to create while the LIMIT is present on the query. If I take the LIMIT off the procedure creates. CREATE PROCEDURE LimitTest(IN in_start INTEGER UNSIGNED, IN in_limit INTEGER UNSIGNED) BEGIN DECLARE no_more_results INTEGER DEFAULT 0; DECLARE var_result INTEGER UNS...

Updating table based on Select Query in StoredProc / ColdFusion

I am using ColdFusion for for a project and I have a written a query which I think can be faster using a Stored Proc, but I not a T-SQL person, so I am not sure how to do it to compare. I am running an initial query which selects a number of fields from a table based on a dynamically built cfquery. I think I know how to convert this qu...