stored-procedures

Is there a way to get Stored Procedures to constantly refresh their Timeout Expiration TSQL?

Hello, I wrote a pretty complex Stored Procedure that takes about 2 minutes to run (Is is a single Update statement). However, in this 2 minutes of time the stored procedure times out. I was wondering if there was a way to refresh the Stored Procedures timeout expiration so that I don't have to change the servers timeout from 30 seconds....

How can I view the original SQL that created a stored procedure in SQL Server 2008?

The title pretty much says it all. How can I view the original SQL that created a stored procedure in SQL Server 2008? Is this possible? I've been searching online for some leads, but I'm either missing correct vernacular or I'm just looking for something that can be found by some other means. My basic problem is that I've got a SQL ...

Using "WITH OVER" statement - How to start new sequence number when another group of records are started?

Using WITH OVER or by using other method, how to start new sequence number for another group of records? It is SQL Server 2005. E.g. how to get following ouput (I am talking about RowNum column in expected output)? Table: id name 100 A 200 B 300 C 200 B 200 B Expected ouput: RowNum id 1 100 1 200 2 ...

How to get rid of "Error 1329: No data - zero rows fetched, selected, or processed"

Hey guys I have a stored procedure which does not need to return any values. It runs smoothly and without any problem. However, it outputs an error message (Error: No data - zero rows fetched, selected, or processed) after finishing its run. How can I get rid of this error message? (It is a simplified version of the procedure so, please ...

How do I create and use a stored procedure for SQL-Sever which will delete the data in all tables in a database with VS 2010?

I've been using the entities framework with ASP.NET MVC and I'm looking for an easy and fast way to drop all of the information in the database. It takes quite a while to delete all of the information from the entities object and then save the changes to the database (probably because there are a lot of many-to-many relationships) and I ...

Migrating a database from MS SQL to MySql - How time consuming / difficult is it?

A client wants a database converting from MS SQL to MySql. Personally I wouldn't do this, I prefer MS SQL for larger databases and like the tools available when working with MSSQL. However I do use MySql on smaller projects. I've never moved a database from one to the other, or made much use of sprocs when using mysql. Is there a lo...

Complex Select Query Vs Creating a Temp Table and then inserting values in temp table and then selecting it

I was just wondering which approach is better. Creating a complex select query with many CASE WHEN THEN ... ELSE ... END statements or sub queries in select clause. Create a temp table and then insert and update it. Finally select * from @tempTable This question is only for complex queries not for simple joins or just when some smal...

Connect to PostgreSQL asp

Dear All, Can you help me to solve how to connect to PostgreSQL by using asp below : <%@ LANGUAGE=VBScript%> <% Set Baglanti = Server.CreateObject("ADODB.Connection") DbDriver ="driver={PostgreSQL}; server=localhost; PORT=5432; database=everyday; uid=postgres; pwd=123" Baglanti.Open DbDriver response.write("Test Success") %> And Th...

mysql Stored Procedure, Query to check if exists or not..

Hi, i am looking for a possible MySqL query which will check to see if a stored procedure exists on the database server, if it does great Return, if it doesnt then i can insert it using c#. any help is appreciated Vade ...

Please can anyone why explain dropping and recreating stored procedures in SQL Server 2005 causes much more of an initial slow down than expected?

My first post here, please be gentle. =) I work for a company that inherited the maintenance of a bespoke system used by one of our customers. The previous developer (no longer with us) encrypted all the database objects (WITH ENCRYPTION). The system has been plagued with various timeout issues well before we took ownership of it, and ...

SQL Server: help with a simple stored procedure?

I'm trying to create a simple stored procedure which I can use to write data to a log table. I'm a noob in stored procedures, so what I'm missing here? I get an error saying: Msg 201, Level 16, State 4, Procedure toLog, Line 0 Procedure or function 'toLog' expects parameter '@messageTime', which was not supplied. How to modify this co...

How to troubleshoot sql server performance problem

Ok this general problem has reared its ugly head twice in the past 6 months (different stored procedure). We have our internal users report a timeout error in the application. We can reproduce the problem in the application in a controlled environment. So we go through the normal steps of checking for blocking using sp_who2. Everything l...

last time procedure executed in Oracle 11g

Is it possible to know when a stored procedure was last executed? I'm using Oracle 11g. I've got an old app that has many years of procedures in it. The goal is to quickly identify candidates for retirement. Thanks, Mike ...

Using Checkbox to Delete row in Gridview with Visual Basic.net code behind and Stored Procedures

Tools for my website. Visual Studio 2010 SQL Management Studio asp.net visual basic.net I am using GridView. Because of my search code I am not able to use the automatic delete function that GridView has to offer. I clicked on GridView, said "Add New Column" and added a checkbox column. I want to be able to check one or more boxes an...

Efficiently pulling thousands of records with SQL Server?

This is kind of a part 2 to this question: http://stackoverflow.com/questions/3319842/select-rows-and-update-same-rows-for-locking I have a table in my database that hold millions of records. I have created a stored procedure to pull X amount of records and mark them as being locked so when my application calls the next set of X amount ...

How stored procedure is processed by Sql Server and .Net

I have been using stored procedure for more than 1.5 years. But I never thought how data is retrieved from UI or within another stored procedure. When I writes a simple stored procedure. eg. CREATE PROCEDURE sp_test AS BEGIN SELECT * FROM tblTest --Considering table has 3 columns. END How does C# gets this result into DataTable. Wh...

help with SQL query?

Hi Guys, I am not sure if I should do this in the code or do it in the query, but I will ask it here as I am interested in a sql solution for myself. Say if I have the following table, and I need to get all the rows whose ParentSID is 1. But if any of these rows return have Null as FID then I also need to go fetch all rows whose Parent...

In PL/sql oracle stored procedure,trying to use analytical functions

Is it better to use cursor or analytical functions in a stored procedure for performance improvement? ...

T-SQL optimizing performance of various stored procedures question.

Hello, so I have written several stored procedures that act on individual rows of data by taking in an ID number. I would like to keep several stored procedures that can call this stored procedure at different levels of my database scheme. For instance, when a row is inserted I call this stored procedure. When something else is modified ...

T-SQL - text field to nvarchar

I have a 'text' type in a SQL table (BigNote), and a new nvarchar(2000) field (LittleNote). I need to save the first 2000 characters from the @BigNote into the LittleNote field within a stored procedure. Can someone share some thoughts? Do I need to check for: - nulls? - the BigNote length and only grab the exact amount? It is work...