stored-procedures

DataSet StoreProcedure Table names

Hi, I am calling a stored procedure to return two tables. I am getting it as a dataset in my console application. The table names in the dataset are something like TABLE,TABLE1. Is there anyway to change this to a meaningful names from stored procedure?? Thanks, Mahesh ...

c#/sql-server, trying to get data to two ddl's from two tables...in one sqlDataReder

Hi all, Well, i am tring to do something nice (nice for me, simple for you guys), i was told i can do it, but i have no idea where to start. I have two DDL's in a page, i need on page_load to popolate both, each one gets data from deferent table with no relaition between them (suppliers/catagories). i know how to do it with two DB conne...

2147217833 String or binary data would be truncated

Hi Have an error occuring when I try to update a record via stored procedure. The error I get is 2147217833 String or binary data would be truncated. I've done a length on each of the fields that I'm inserted and they should be fitting comfortably in to the the database fields - i.e. the length isn't greater that the column specificatio...

how to write an if condition case in stored procedure

i have an table where i am passing 5 paramter table name=" image" parameter @imageID, @imageName, @imageDirectory, @imageResource, from the front end [from page that is from textbox control] if they didnot send any values to stored procedue then i should do an simple Query condition1: select * From image condi...

What is the right way to call an Oracle stored function from ado.net and get the result?

I've got a vb.net codebase using ado to connect to an Oracle database. We have lots of stored procedures that we call, some with multiple out parameters. However, I now need to call a stored function, and it's not clear to me how to get the result of the function back into my VB code. Edit: I'm returning an integer. How do I properly c...

MySQL foreach alternative for procedure

My problem is fairly simple. I have table sets that store product sets (more products looking like one on the outside - computer, mouse and keyboard for ex.) it's connected M:N using sets_products table to products table. Each product can have parameters (connected again M:N). I have a procedure, that generates all parameters as string...

Update and Insert Stored Procedure

I want to create a stored procedure that performs insert or update operation on a column if that column does not contains a value that already exists in database it should allow insert when COUNT(field) = 0 or update when COUNT(field)=0 or 1 And I should know that either of these operation is performed or not. Please solve my problem us...

Can a SQL Server Trigger send me an email?

I wish to send an email from a Trigger, on my SQL Server 2008 machine. The data of the email will be, basically, some of the Trigger information. Can someone provide some simple/sample code on how to do this, please? E.g. what's the system stored procedure called? Etc. I've not set up any SQL mail and stuff, so I'm guessing it's built ...

How to do a firebird SP, SELECT * FROM "TABLE"?

I'm migrating from SQL Server to Firebird. In SQL Server CREATE PROCEDURE Departments_GetAll AS SELECT * FROM Departments I try in Firebird CREATE PROCEDURE DEPARTMENTS_DELETEALL AS BEGIN SELECT * FROM "Departments"; END^ SET TERM ; ^ But that doesn't work. It returns an error "SQL Code -104" ...

Anyway to decrypt an encrypted sql server stored procedure?

Hi There, I have a couple of ms sql server (2000) stored procedures encrypted by ex-employee long time ago and things were okay until we need to change it a bit.... is there any way at all to retrieve the source? Or rewrite is the only option? Thanks a lot. ...

Using stored procedure in crystal report 8.5?

I have made a new report using Crystal Reports 8.5 (report1) which uses a stored procedure as its data source. The stored procedure has 2 input parameters (@p1 and @p2) and when I enter some test data for @p1 and @p2 within crystal report IDE , every thing is all right. Then, I added the report1 in visual basic 6.0 IDE and added a new fo...

SQL-Statement with dynamic table-names or redesign?

I have a MS SQL 2008 database which stores data for creating a weighted, undirected graph. The data is stored in tables with the following structure: [id1] [int] NOT NULL, [id2] [int] NOT NULL, [weight] [float] NOT NULL where [id1] and [id2] represents the two connected nodes and [weight] the weight of the edge that connects these nod...

How can i set an integer varable using stored procedure

Hi there. exec SP_HastaIcmal_AktifKaliciHastalar 25 it returns 86. DECLARE @iAktifKaliciHastalar int SET @iAktifKaliciHastalar = exec SP_HastaIcmal_AktifKaliciHastalar 25 that code return error. Msg 156, Level 15, State 1, Line 3 Incorrect syntax near the keyword 'exec'. ...

Stored proc running 30% slower through Java versus running directly on database

Hi All, I'm using Java 1.6, JTDS 1.2.2 (also just tried 1.2.4 to no avail) and SQL Server 2005 to create a CallableStatement to run a stored procedure (with no parameters). I am seeing the Java wrapper running the same stored procedure 30% slower than using SQL Server Management Studio. I've run the MS SQL profiler and there is little...

How to manage NULL values with numeric fields in cursor?

How to manage NULL values in numeric fields returned by cursor in Select stament, to manage efficienly aritmetic operations ? ...

SQL with table name as parameter and query longer than 4000 characters

I am trying to write a stored procedure that takes a table name as a parameter. Yes I already know this is a security vulnerability, but this is an internal stored proc that doesn't face typical risks of SQL Injection. What I have so far is something like the following: CREATE PROCEDURE [dbo].[myprocedure] @tableName sysname AS DEC...

Why I can only execute a stored procedures two times?

In my VB.NET code I construct a ODBC.COMMAND to call a stored procedure that eliminates a record from table in SQLSERVER 2008, I use this code in a FOR NEXT loop, it may contain 1 to 20 records_ID to pass to stored procedures to delete the records. This code work well for several months, but since the last compilation it only deletes th...

Is there a better way to debug "wrong number or types of arguments in call" errors?

So I've recently been vexed by problems similar to this one: Oracle .NET error - Wrong number or type of arguments. I know oracle is famous for its terrible error reporting, but this is a giant pain to debug -- if you have ten parameters, that's twenty things to check by hand (types and names,) not to mention the actual number of paramet...

How to Parse and Append text to a stored procedure in SQL Server 2005 via a parameter

Does anyone know of a way to append text to a stored procedure from within another stored procedure? I would like to do something like the following in SQL Server 2005: Declare str as Nvarchar(Max) = '' set @spStr = dbo.spTest + 'Where testCol1 = ''Test''' exec(@spStr) I understand this may open some discussion about SQL ...

dispalying error returned by stored procedure in .aspx form

hey i have a stored procedure which i use to insert values in a table...if i implement error handling in it using @@ERROR and if i it returns error in a variable @myError can i display this error in my .aspx form??i m using sql server 2005 thanx.... ...