stored-procedures

Create entire DataSet from existing stored procedure

Hi, I have stored procedures (they accept parameters) that return multiple result sets and I'd like to have this saved in a typed dataSet. The question is: can I have Visual studio 2010 generate the typed dataset based on stored procedure? I know I can have this for a single table, but I need the whole dataSet (multiple tables, one for...

SQL Server: Why would i add ";1" to the end of a stored procedure name?

i came across a compatibility issue today, as a customer upgraded from Windows XP to Windows 7. The (12 year old code) is calling a stored procedure on the SQL Server called ai_nextid Except that when it calls the stored procedure it is using the name: ai_nextid;1 Yes, with a ";1" appended. Apparently the SQL Server driver in Win...

Stored Procedure fails when performing Update

Hi everyone, I'm using the SQL Server Driver for PHP to connect to an SQL Server 2008 Express. Right now, I'm trying to replace all SELECT, UPDATE and INSERT statements by stored procedures. This is working fine for SPs that just contain a SELECT statement. But now I tried to do one with an update, and I keep getting the error message "...

Calling a Stored Procedure in Hibernate

I just started learning hibernate last night and its rather fun. I am some trouble calling a stored procedure as a sql-query with hibernate. I have attached the source and the error, please help me. Thanks :) <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "hibernate-...

How to encourage myself to switch to ORM?

I'm working with a legacy project of my team-mate (.NET/Oracle). The project is not yet completed, it's under construction and far from production. He followed a "traditional way" to access data, which is creating stored procedures and then use database driver to call them. I want to follow a "modern way" to access data: use an ORM to ab...

microsoft reportviewer

anyone has a code sample to connect the Microsoft Report Viewer Control using Microsoft SQL Server stored procedure? ...

MySQL transaction in stored procedure

I created a transaction in a stored procedure with some update statements. What will happen if the transaction is running, and one select request the value from the updating table? ...

How to identify the caller of a Stored Procedure from within the Sproc

I have a depricated stored procedure which should no longer be called from code, but there is some system which is still calling it. This is a production server so I have very limited indirect access to it for performing diagnostics. Is there any way to determine the machine which is calling a particular stored procedure from within th...

Is it possible to pass table name as a parameter in Oracle?

I want to create a stored procedure like this: PROCEDURE P_CUSTOMER_UPDATE ( pADSLTable IN Table, pAccountname IN NVARCHAR2, pStatus IN NUMBER, pNote IN NVARCHAR2, pEmail IN NVARCHAR2, pMobi IN NVARCHAR2, pServiceTypeID IN NUMBER, pDate IN DATE ) IS BEGIN UPDATE pADSLTable ...

Print Statement in SQL procedure should affect Performance ?

I am using SQlserver procedure and i have habit of using of Print Statement in PRocedure to differentiate the code of PRocedure. I have almost 200-250 procedure in my DB. Should print statement affect the Performance? I am working on MultiUser Windows application. ...

SQL Server: how to query when and where (which database) logins take a connection?

I have many databases in one SQL Server instance. Also I have many individual domain users for logins and also domain groups as logins. These logins are attached to databases as database users. Now I would like to create a report (or a query) to find out when and where (which database) these logins take a connection. I tried to find this...

SQL Stored Procedure - Count Specific Not Null Columns in a Row

Hey hey! I have a table with multiple columns and rows - from which I need to select the count of two specific columns which are not null. In other words: LoadID,StudyID,Data,Structure,Status,Progress,Error,FileType Select the count of not null data and structure where LoadID= a number I know I could do nested IFs, but I wonder if t...

procedure give me garbage data in some fields

I have that code: string pathToSave = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); string file = pathToSave + "\\" + "produkty_" + lang + ".csv"; FileStream fs = new FileStream(file, FileMode.Create); StreamWriter sw = new StreamWriter(fs); // sw.WriteLine("id;Akt....

T-SQL UNION query to return items with highest and lowest rating from the same table

I want write a stored proc in T-SQL to return the top 5 most highly rated and the bottom 5 most lowly rated articles from an Articles table, determined by the 'rating' column. I was thinking of using a union on two selects but I'm not sure how to write it. ...

stored procedure which solve me names of column of table

Hey, I need a stored procedure which in parameter have name of table(varchar) and it return names of columns in this specific table. It is possible ? I think about some SELECT which retrieve this names from table but I am weak at SQL :/ I add that I use Firebird 1.5 :/ ...

Executing TRACEON in a Stored Procedure as a public user

Running SQL Server 2000. I have a linked server over ODBC to Providex data files. Never mind mind if you are not familiar with them, the point is that for SQL Server to be able to select from the linked server, an arcane and undocumented TRACE needs to be turned on. The exact command is: DBCC TRACEON(8765) The problem is that i need to ...

Why can't SQL Server alter a view in a stored procedure?

I'm using MS SQL Server, and I'd like to alter a view from within a stored procedure, by executing something like "alter view VIEWNAME as ([some sql])". A few pages thrown up by google assert that this is not supported directly (and neither are related alter-table statements), but there are also examples of how to work around it using c...

Measure stored procedure duration

Hi, In my application I want to know the execution time for a stored procedure. My pattern is to execute reader and get the data reader and read the results. The reader return immediately and I don’t know the stored procedure execution time. I cannot put the timers after the reader because I want to have an extension method to encapsu...

Pagination of oracle result set, returned by stored procedures

Hi all! In our project, we have all DB manipulations concentrated in Oracle stored procedures. Result sets is returned by OUT parameter of SYS_REFCURSOR type. Now we have a task to make pagination, and we don't want to rewrite all of our procedures, adding 2 parameters (pageNumber and pageSize) to them and editing WHERE clauses. We have...

Is it a good idea to use varchar(max) as a stored procedure argument?

I have a stored procedure that takes a string of a pipe delimited array of IDs and parses them out. I want to have this happen in a transaction, so don't want to pass them in one at a time. If I use varchar(max) as to not limit the size of the argument passed in, will this cause problems? I don't see the limit being hit, but I also don'...