stored-procedures

Everytime I try to communicate with my database with stored procedures I get this "Cannot perform this operation on a closed dataset"

I'm working on a Delphi project with a MS SQL Server database, I connected the database with ADOConnection, DataSource and ADOProc components from Borland Delphi 7 and I added this code in behind: procedure TForm1.Button2Click(Sender: TObject); begin ADOStoredProc1.ProcedureName := 'sp_Delete_Clen'; ADOStoredProc1.Refresh; ADOStor...

Is there anyway of converting c# function to sql server stored procedure?

Hi, I have a stored procedure which is written in c#: SqlConnection scn = new SqlConnection("context connection=true;"); SqlCommand scm = new SqlCommand("Select * from EPMS_Filters",scn); SqlDataAdapter sda = new SqlDataAdapter(scm); DataSet ds = new DataSet(); //template for select Query. Stri...

Performances for a Sql Server query or stored procedure to fill lot of data

Hi, It is a question for SQL Server 2008 and .NET code. I am wondering what you think in terms of performances, design between these two options to insert a lot of data (>250,000 rows, 5 “normal” columns) into a table using a transaction. a. Insert Into statement surrounded by transact statement in the c# code. Or b. Insert Into ...

Entity framework calling a FOR XML stored procedure truncates at 2033 characters

I have a stored procedure which uses a FOR XML statement at the end of it, and returns me some XML. I am using .NET 4 and the Entity Framework and when I do a function import of this stored procedure and try to call it through the Entity Framework it truncates the return at 2033 characters. I swapped the Entity Framework for a traditi...

CSV Import with Validation

I have a need to import a number of CSV files into corresponding tables in SQL. I am trying to write a stored procedure that will import any of these CSV files, using a number of parameters to set things like file name, destination name etc. Simple so far. The problem comes because of the structure of this DB. Each data table has a numb...

Reduce dynamic SQL using CASE to use "IN" or not

I am converting a stored procedure which I had previously written as a string then, using BIT parameters I decided whether to append certain WHERE/ON clauses This sp is passed a number of comma-separated strings and then some of the dynamic WHERE clauses are like: IF @pUse_Clause_A THEN SET @WhereClause = @WhereClause + ' AND [FIELD_A]...

Data not returned

I am using Visual Studio 2005. I have a stored procedure that retuns all the data, the dataset on the data tab of reporting service returns all the data, but the matrix in the report doesn't. it looks like it is pulling all of the data but the last 3 sites. is there a setting i need to adjust to get it to show all of the data? and not...

Generic Stored Procedures

I am writing a stored procedure to handle the populating of a database from csv files. There about 150 tables and there will be 1 CSV file per table. There is some added complication in that data needs to be validated against a validation table on import. I am currently writing a single Store Procedure, that will take the csv file name...

mysql stored procedures limit of lines/characters

Hi guys, once again I've run into a problem with mysql stored procedures. It's a tricky one and I'll stupply some teest data. Basically I have this load of text Operation Manna - Lancaster Series (7) The 29th April sees the anniversary of one of the most unusual RAF Lancaster operations in WW2. The Netherlands was deep in what became...

Can I reuse the connection from DataContext in Linq to Sql?

DataContext has Connection property of type DbConnection and I was wondering if I could re-use it. I've tried to use it creating a command using CreateCommand and using a reader off of it but I've gotten errors saying there is a pending transaction or something similar. Basically I'm trying to find out if there is a best practice or gu...

how do I create a stored procedure from within a stored procedure

I would like to manage the deploy of stored procedures by first inserting them into a table, then, when it's time to deploy.... use a stored procedure to create all of the stored procedures. (Execute seems to be limited to CRUD) ...

Mass sending data to stored procedure

Hi Gurus I'm using Microsoft .NET Framework 3.5 to create a web service with VB.NET. I'm using a Stored Procedure in SQL Server 2008 so that SQL can insert all the data that I'm passing. The problem is that in one of the servicse I need to pass around 10,000 records and it's not very efficient to run the stored procedure 10,000 times. ...

Stored Procedure with SimpleRepository

Hi, How to I execute a Stored Procedure with SimpleRepository and get a Typed List as a answer? I'm using SubSonic 3. Thanks. ...

Subsonic 3: Strongly typed return value for stored procedures that return mixed results from different tables

Say I have a stored procedure that returns dataSet from 2 different tables. Example: SELECT Customers.FirstName, Customers.LastName, SUM(Sales.SaleAmount) AS SalesPerCustomer FROM Customers LEFT JOIN Sales ON Customers.CustomerID = Sales.CustomerID GROUP BY Customers.FirstName, Customers.LastName Is there any way to get a strongly ty...

SQL Server: Conversion failed when converting from a character string to uniqueidentifier.

I've been banging my head against a wall for the past hour trying to figure this out, sql is giving me the following error Msg 8169, Level 16, State 2, Procedure GetAppointmentsByProfessionalName, Line 6 Conversion failed when converting from a character string to uniqueidentifier. when this stored procedure is executed -- ======...

Will a join still work if the column being joined is null?

I've got this stored procedure, and when I add the join I get no results. Is this because the column used for the join condition, ForClientID, is null? Would that affect the results of the table? If i select the table with Appointment.ForClientID instead of Client.Name, the rest of the table loads with the ForClientID column being null. ...

Constants and Include files in TSQL

Is it possible to include a set of 'constant' values in a TSQL stored procedure? I have a situation where I'm using an integer field to store bit values and I have small set of 'constant' values that I use to insert/select against that field DECLARE @CostsCalculated int = 32 DECLARE @AggregatedCalculated int = 64 --Set CostCalculated b...

How to insert selected value in insert statment in sqlserver

i need to insert 4 column in sql table fist 2 column i have type remain 2 column i have to get it from another table ..how combine and insert this in single query ...

using stored procedure selected values with where clause on query

I created a stored procedure with table variable and inserted the values to the table variable and returned the table variable column and returns number of integer values.Now i need to select the records from a table depending on the returned result. ...

how to pass cursor as IN parameter to a stored procedure

Hi, I want to pass a cursor to a stored procedure as IN parameter from my xyz.java file. I am using spring and hibernate. Can you help me with this. Needed urgently.Reply soon. And if cannot pass then can you help with some alernative. Thankyou. ...