stored-procedures

Linq to Enities: Result set not getting updated after Stored Procedure Call

In LINQ to Entities, I map the result set of a stored procedure to an entity. Within the stored procedure, I execute some update statements and return the result set by running a SELECT query and mapping that result set to the entity. The database rows get updated correctly, but the entities returned are not reflecting the changes. Ins...

Oracle PL/SQL Denomalised Results

Hi, Given three tables: a car table, an extras table and a link table, something like: table_car --------- int car_id string make string model table_extras ------------ int extra_id string extra table_car_extras_link --------------------- int car_id int extra_id I'd like to write a PL/SQL stored proc that returns data in the follow...

How to use XML to configure a Store procedure

What I'd like to do is keep some configuration in an external XML file and my stored procedure to open this and use the settings defined in it. Is this possible? I dont want to store the XML in a table. ...

Execute procedure in a trigger

Is it possible to execute a stored procedure inside a trigger? Thank you ...

SQL Server: Can I set a trigger on ALTERing a stored proc?

Everytime a stored proc is ALTERed or CREATEd, I want to capture that in a trigger to do some stuff afterwards. Can I do that in SQL Server 2008? Thank you. --Beemer ...

<Sql-insert> for sub-classes

I have an object mapped as follows: <class name="A" table="TableA"> <id name="ID" column="AId" type="Int32" unsaved-value="0"> <generator class="native" /> </id> <discriminator column="Type" type="Int32" /> <property name="Description" /> </class> <subclass name="B" discriminator-value="0" extends="A"> <prop...

SQL Server Stored Procedure Fails due to use of XML/ ANSI_NULLS, QUOTED_IDENTIFIER options

I have a stored procedure which takes an XML parameter and inserts the data into multiple tables. If I run the stored procedure into a database using a SSMS query window, everything works fine. However, we have a custom installation program that is used to deploy stored procedures to databases, and when this is used, execution of the sp ...

While select in mysql stored procuder

i will try a select into my Stored Procedure like a while e.g. while ( select * from t where t.c = 1 into test_t ) { var_t_e = test_t.c; } i hope i can be helped here. :) ...

Stored Procedure calls multiple stored procedures

When calling several stored procedures for one stored procedure is this the right or best way to go about it on SQL Server 2008 ? CREATE PROCEDURE [dbo].[DoStuff] AS BEGIN SET NOCOUNT ON; declare @result int BEGIN TRANSACTION BEGIN EXECUTE @result = dbo.UpdateTHIS @ID = 1 IF @result != 0 ROLLBACK ...

Stored procedure not updating table when called from C#

I have a stored procedure that should update a table. When I run it directly I get “Command(s) completed successfully.”, but when called from C# it does not change the table. What is going wrong? set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go -- ============================================= -- Author: Mohamamd Ibrahim Tasal -- Create ...

Performance concerns between DataSet and StoreProcedure

Hi everyone! I have to develop one program that consists Data manipulation (Retrieve data, Update Data and New insert data) to multiple tables. Which will be suitable approach and faster in performance using DataSet Object and Storeprocedure with CURSOR object? Please point me out. Thanks you all! ...

LINQ to SQL testing

Hi I'm using Linq to sql to access an SQL Server. I try to write all my database queries in a partial class so they can be accessed directly from the DataContext. Now I would like to test the Data Context but I can't figure out the best way och doing that. Bascially I need to test 3 things: 1. The queries return the correct data (no...

Optional where clause / parameter in a SQL 2008 stored proc?

Hi everyone, I'm writing some code that updates a table. Depending on what the user wants to do, it either updates a large set of records, or a smaller one. The delineating factor is a group ID. The user can choose whether to update the table for all records, or just those with that groupID. I'd like to use the same stored procedu...

Reset or Update Row Position Integer in Database Table

Hello, I am working on a stored procedure in SQL Server 2008 for resetting an integer column in a database table. This integer column stores or persists the display order of the item rows. Users are able to drag and drop items in a particular sort order and we persist that order in the database table using this "Order Rank Integer". ...

Changing stored procedure

I have a proc that print checks if there is any new checks to be print. If there is nothing to issue new checks it wont print any. Now i want to modify this proc like even if i don't have any new checks to be print, it should pick up at least one check to be print.( even if it is already printed). Can you tell me how to do that. Here is...

Unable to execute stored Procedure using Java and JDBC on SQL server

I have been trying to execute a MS SQL Server stored procedure via JDBC today and have been unsuccessful thus far. The stored procedure has 1 input and 1 output parameter. With every combination I use when setting up the stored procedure call in code I get an error stating that the stored procedure couldn't be found. I have provided t...

Informix: Fifo valuation with SQL/Stored procedures

I am using IDS 10 and I have a simple transaction table with the inventory changes with product ID, transaction time, volume, quantity and price. Is it possible to determine the FIFO valuation solely with SQL/Stored procedures or do I need to use something like Perl with DBI for the cursor handling? Fifo valuation requires cursor-handlin...

Error creating stored procedure

Hi Im trying to create this stored procedure: CREATE PROCEDURE GetExif ( IN @album VARCHAR(50), IN @pic VARCHAR(50) ) BEGIN SELECT CAMERA, FSTOP, EXPOSURE, ISO, FOCALLENGHT, DATETAKEN, GPSLATH, GPSLONG FROM EXIF WHERE ALBUMNAME = @album AND PICTURENAME = @pic END I get this error #1064 - You have an error in your SQL syn...

Calling a Stored Procedure in Oracle

Hey all, This should be something fairly simple and straight-forward but for some reason I can't get it to work. I've created my SProc like so: create or replace procedure zadmit_migrate_data (zadmit_seq_no number) is thisPIDM number; begin select pidm into thisPIDM from saturn.zadmit_core_data where pk_seqno = zadmit_...

How to declare array inside Sql Server Stored Procedure?

Hi All I need to declare 12 decimal variables, corresponding to each month's year, with a cursor I sum values to this variables, then later I Update some sales information. I don't know if sql server have this syntax Declare MonthsSale(1 to 12) as decimal(18,2) This code works Ok. ! CREATE PROCEDURE [dbo].[proc_test] AS BEGIN -...