When executing a stored procedure in .NET code, are all statements inside the procedure considered to be a unit of work, or do I have to run this procedure inside a transaction (either by modifying the procedure, or by starting and comitting a transaction in .NET code)?
In SQL Server, each individual statement, whether executed as a single batch, as a statement within a batch, or within a stored procedure, is independent. If you need the ACID properties to apply over multiple statements, you need to create a transaction.
In a stored procedure this is easiest to do with the BEGIN TRANSACTION statement. Use COMMIT TRANSACTION when you're done, to keep the results, or ROLLBACK TRANSACTION to discard them. Be aware that the transaction is not automatically rolled back for non-fatal errors, that is, errors that do not abort the batch. You should check @@ERROR after each statement to check whether there was an error.
DoEvents: Generating unexpected recursion since 1991
I have an application which uses Pervasive SQL as a backend.
Is there any tool for Pervasive similar to Microsoft's Profiler for MS SQL server?
i would like to monitor the queries being executed behind the application?
I have created rdl file with 80 columns data table. I will hide the columns if data column is blank. My problem here is, if i export 1 page of data into pdf format then i am getting three pages of report. Here last two pages are blank.
Actually what is happening here is, I am selecting only 20 columns out of 80 columns. So report is showing only 20 columns and hiding remaining 80 columns. It is just hiding the columns but it is using that 60 columns space. Thats why i am getting two blank page.
Could any one tell me, how can i remove/avoid column space if data column is blank.
I want to create a temporary table at runtime. After that a cursor will be called to fetch necessary records. I want to insert each of these records into a temp table. How a single stored proc will do this? Any help..
I thought I'd put this to you, my fellow devs, as I just cant decide the most efficient route!
Suppose I have 2 tables, 1: id, productid, datedelivered, qty AND 2: id, productid, datesold, qty
I would like to end up having a result with: productid, monthvalue, openingbal, delivered, sold, closingbal
(monthvalue being something like 2008-01-01, i.e. each like is the stock recon for the month)
Now I know there are a few ways of doing this, one I thought of is with a cursor. But not being too clued up with the new features that 2005 provides I am not sure what the most efficient way would be ... any ideas?
I'm using ASP.NET and MySQL. I want to count all posts that were added before or in a specific month. The query is run in a loop and the results will be put into a graph but I get really strange numbers in some months.
"SELECT COUNT(*) FROM posts WHERE YEAR(timestamp) <= YEAR(?date) AND MONTH(timestamp) <= MONTH(?date)"
Well, the height of each bar in the graph are supposed to increase from left to right so I can see what the total was after each month. The result I'm getting though is not a steady increase. It's going up and down, up and down, up and down and then there's obviously something wrong because it's impossible that it would go down if it worked correctly.