Can any one explain the below query for getting the 3 maximum salaries? Someone suuggested to me the use of the above query to get 3 max. salaries in a table. I didn’t understand what is happening in the below part of the query: Can anyone explain it? if there is any other way to get the same result,ple…
Call the maximum from SQL table to textbox
I am working on a Windows Forms C# application and I need to auto generate my invoice number from my database. For that I need to get the maximum value from the database and want to add one with the max value in db, any idea Answer You could design your database table using an IDENTITY column. The database wi…
Auto increment function, Oracle PL/SQL
I have a number of triggers which do various things, but at the top of all of those which have unique integer primary keys, I need them to auto increment. The code currently looks as follows: I thought it may be useful to make a small function for this, as I would if this were a conventional programming langu…
Query Totaling Multiple columns and grouping by another
I am trying to get some totals of multiple records based on Location – but get totals for multiple columns to present back – basically there are various locations and each location has different species and totals at that location. Without doing something really ugly – I have no idea of the …
JPA with HIBERNATE insert very slow
I am trying to insert some data to SQL Server 2008 R2 by using JAP and HIBERNATE. Everything “works” except for that it’s very slow. To insert 20000 rows, it takes about 45 seconds, while a C# script takes about less than 1 second. Any veteran in this domain can offer some helps? I would app…
Storing a huge amount of points(x,y,z) in a relational database
I need to store a very simple data structure on disk – the Point. It’s fields are just: Moment – 64-bit integer, representing a time with high precision. EventType – 32-bit integer, reference to another object. Value – 64-bit floating point number. Requirements: The pair of (Mome…
Add/remove columns of a table – code maintenance / optimisation
What is the best way to maintain code of a big project? Let’s say you have 1000 stored procedures, and you have to add a new column to a table (or remove) There might be 1-2 or 30 stored procedures, that might be affected. Just a single “search” for the tablename might not be good enough, le…
SQL Insert Query Using C#
I’m having an issue at the moment which I am trying to fix. I just tried to access a database and insert some values with the help of C# The things I tried (worked) A new line was inserted and everything worked fine, now I tried to insert a row using variables: Didn’t work, no values were inserted…
Using HoldLock Incorrectly in SQL Server stored procedure
I believe I am using HOLDLOCK incorrectly. The reason I think this is because I have a table that acts like a queue. The queue receives its items from the SQL below and gets processed, one by one in a console application. I haven’t tested yet but I believe when this console application starts processing…
MySQL Query selection
I have a big database table called pricing. The fields are following: id code description rrp buy stock date distributor vendor version User select the vendor field only. version field can be vary …