stored-procedures

T-Sql Modify Insert SProc To Update If Exists.

Scenario I have a stored procedure written in T-Sql that I use to insert data into a table as XML. Since the data gets updated regularly, I want the rows to be updated if they already exist (Aside from when the application is first run, they will always exist). Question Below is the code of my Insert Sproc, however I cannot seem to wo...

How to rename an Oracle procedure

Is there a way to rename an oracle procedure, without having to drop and recreate the procedure? ...

how to fetch the row count for all the tables in a SQL SERVER database

I was in search of a SQL Script , in order to determine , if there is any data(row count ideally) in any of the tables in a given database. The idea was to re incarnate the database , in case if there are any rows existing(in any of the database) . The database being spoken of is SQLSERVER. Could Someone suggest a sample script.? th...

How to make a Firebird SP, get lines from some dynamic TABLES ?

My tables have some inner pre-fix that users must not know. So I made a SP like this to retrieve lines. CREATE PROCEDURE p_Test ( inStation varchar(10) ) RETURNS ( ServiceName varchar(20) ) AS DECLARE VARIABLE StationTable varchar(20); BEGIN StationTable = 'TSTATION_' || Upper(Trim(inStation)); SELECT Station...

can i return a custom result after reviewing a stored procedures' result?

I want to return custom values as the values of the rows in case when no rows are fetched by executing the stored procedure - is there a way to do that? ...

MySql: How do you use mutex/lock in a stored-procedure

I want my function to only run once. Meaning that if many threads call it at the same time, the function will block all threads apart from one and only allow it to run. ...

What is mysql version of @@ROWCOUNT

how can i get row count values in mysql as @@ROWCOUNT in mssql ...

custom result after reviewing a stored procedures' result

I want to return custom values as the values of the rows in case when no rows are fetched by executing the stored procedure How do i do that? ...

How can I duplicate a SPROC-table dependency graph after these SPROCs have been replaced with DALs implemented outside the database?

I need a solution for an enterprise environment with 100s of applications and SQL databases. A current architecture standard requires that all applications implement DALs using SPROCs. One reason for this is that, when performing ongoing migration, obsolescing or modifications to databases, dependency graphs between these SPROCs and data...

ADO.NET and SQL Server stored procedures - SELECT after INSERT, UPDATE, DELETE

In a large project relying on SQL Server stored procedures and classic ADO.NET (DataSets, DataAdapters) after INSERT, DELETE and UPDATE procedures there is a SELECT following. In code, all the methods return void, is this SELECT of any relevance - what effect does in have? What is the performance impact of the SELECT? ...

Using LinqSql, stored procedure returns datatype image problem

Hello! I´ve got a problem when using LINQ to execute a stored procedure and return its values. One of the column that the stored procedure returns is of datatype image and contains a pdf in binary form.(this because the database is deployed on sql server 2000, otherwised i would choose a blob) When including the stored procedure in my ...

Very Simple Stored Procedure Will Time Out.

I have a problem with this one stored procedure that works 99% of the time throughout our application, but will time out when called from a particular part of the application. The table only has 3 columns and contains about 300 records. The stored proc will only bring back one record and looks like this "Select * from Table Where Col...

Restrict stored procedure to only perform SELECT operations

Is is possible to restrict a stored proc to only SELECT from a database. I want a stored proc which only selects data to execute correctly and a stored proc with UPDATE, CREATE, DELETE operations to return an error indicating insufficient permissions. I am using Sybase 12.5 ...

Result consisted of more than one row Error 1172 mysql

Hello im having a hard time with this stored procedure. im getting the error: Result consisted of more than one row. here is my stored procedure: DELIMITER $$ DROP PROCEDURE IF EXISTS `dss`.`COSTRET` $$ CREATE DEFINER=`dwadmin`@`192.168.%.%` PROCEDURE `COSTRET`( TDATE DATE) BEGIN DECLARE done INT DEFAULT 0; DECLARE ls_id VARC...

MySQL Result consisted of more than one row

Hi there im just new here and i have a question regarding my error on mysql it said Result consisted of more than one row. I have no idea how to solve this your help is much appreciated! DELIMITER $$ DROP PROCEDURE IF EXISTS `dss`.`COSTRET` $$ CREATE DEFINER=`dwadmin`@`192.168.%.%` PROCEDURE `COSTRET`( TDATE DATE) BEGIN DECLAR...

C# Winforms - How to Pass Parameters to SQL Server Stored Procedures

my practice is that i fill use databinded listboxes and using a tablebindingsource and tableadapter. Then to get selective records in listbox i build stored procedure and select required records. But now i want that the stored procedure must take some parameter from some textbox value. like i to implement the following query string q...

How to assign an exec result to a sql variable?

How do you assign the result of an exec call to a variable in sql? I have a stored proc called up_GetBusinessDay, which returns a single date. Can you do something like this: exec @PreviousBusinessDay = dbo.up_GetBusinessDay @Date, -1 Thanks. ...

SQL Server sproc query optimization

I've got an application that generates data for reports that look like: age < 30 | age >=30 | asian | hispanic ----------------------------------------------------------------- clients in prog A | | | ----------------------------------------------------------------- clients in p...

Subsonic 3 - Passing null value to stored procedure parameter

Using Subsonic 3.0.0.3 is it feasible to pass a null value to a stored procedures parameter? If so, what is the appropriate way? Details Say I have an sp where one of the parameters has a default value like: CREATE Procedure Test_SPWithNullParams( @p1 int=null, @p2 varchar(50) ) AS SELECT 1 as Stuff Then in my code I want to...

Need a Creative Sql Query :: HELP

I have a table, a simple table, only has 3 fields. ID Type Date Example of Data (recordset showing 3 of 300) 154 | page | 2010-02-08 154 | link | 2010-02-08 154 | form | 2010-02-08 Id: just an id for a client Type: can only be 3 things that are already populated ('form','page','link') Date: just the date it was cr...