database

Select max in Group

I have a simple table comments (id int, revision int, comment varchar(140)) with some content like this: 1|1|hallo1| 1|2|hallo2| 1|3|hallo3| 2|1|hallo1| 2|2|hallo2| I'm searching for a sql statement which will return each comment with the highest revision: 1|3|hallo3| 2|2|hallo2| I've got a solution select id, revision, comment ...

What causes tables to need to be repaired?

Every so often I get an error saying one of my tables "is marked as crashed and should be repaired". I then do a REPAIR TABLE and repair it. What causes them to be marked as crashed and how can I prevent it? I am using MyISAM tables with MySQL 5.0.45. ...

How to get the ROWID from a Progress database

I have a Progress database that I'm performing an ETL from. One of the tables that I'm reading from does not have a unique key on it, so I need to access the ROWID to be able to uniquely identify the row. What is the syntax for accessing the ROWID in Progress? I understand there are problems with using ROWID for row identification, bu...

How to secure database passwords in PHP?

Hi all, When a PHP application makes a database connection it of course generally needs to pass a login and password. If I'm using a single, minimum-permission login for my application, then the PHP needs to know that login and password somewhere. What is the best way to secure that password? It seems like just writing it in the PHP cod...

Force default value when adding column to table - SQL Server

In SQL Server 2000/2005, Is it possible to force the default value to be written to already existing rows when adding a new column to a table without using NOT NULL on the new column? ...

Why is the DataSourceSelectArguments sealed?

Does anybody know the logic behind making DataSourceSelectArguments sealed? I've implemented a custom DataSource (and related classes) for some custom business objects and custom WebControls. When thinking in filters (like in a grid) I discovered that the DataSourceSelectArguments is sealed. Surely, I'm missing something. (Maybe the log...

What is the SQL command to return the field names of a table?

Say I have a table called myTable. What is the SQL command to return all of the field names of this table? If the answer is database specific then I need SQL Server right now but would be interested in seeing the solution for other database systems as well. ...

can you access a Delphi DBIV database without it creating lock files?

I'm trying to read data from a Delphi DBIV database, every time I access the database it creates a Paradox.lck and a Pdoxusrs.lck file. I'm using only a TQuery Object to do this (nothing else). can I access a Delphi DBIV database without it creating these lock files? Thanks Stew. ...

Technology Plan - Which tools should I use?

Hi, Soon, I'll start my own software company. My primary product/solution will be a Billing/Invoice Software. In a near future, I pretend to expand this first module to an ERP. My app should be able to run as a stand-alone application and as a Web-based application (so there will be, probably two GUI for the same Database). My problem, ...

Oracle OCI array fetch of simple data types?

I cannot understand the Oracle documentation. :-( Does anybody have any pointers to an example how to fetch multiple rows of simple data from Oracle via OCI? I currently use OCIDefineByPos to define single variables (I only need to do this for simple integers -- SQLT_INT/4-byte ints) and then fetch a single row at a time with OCIStmtEx...

The ultimate MySQL legacy database nightmare

Table1: Everything including the kitchen sink. Dates in the wrong format (year last so you cannot sort on that column), Numbers stored as VARCHAR, complete addresses in the 'street' column, firstname and lastname in the firstname column, city in the lastname column, incomplete addresses, Rows that update preceeding rows by moving data fr...

What does a "WARNING: did not see LOP_CKPT_END" message mean on SQL Server 2005?

The above error message comes up just before SQL Server marks the database as "Suspect" and refuses to open it. Does anyone know what the message means and how to fix it? I think it's a matter of grabbing the backup, but would be nice if it was possible to recover the data. I've had a look at the kb article but there are no transactions...

Is Oracle RDBMS more stable, secure, robust, etc. than MySQL RDBMS?

I've worked on a variety of systems as a programmer, some with Oracle, some with MySQL. I keep hearing people say that Oracle is more stable, more robust, and more secure. Is this the case? If so in what ways and why? For the purposes of this question, consider a small-medium sized production DB, perhaps 500,000 records or so. ...

Rails-like Database Migrations?

Is there any easy to install/use (on unix) database migration tools like Rails Migrations? I really like the idea, but installing ruby/rails purely to manage my database migrations seems overkill. ...

Are PeopleSoft Integration Broker asynchronous messages fired serially on the receiving end?

I have a strange problem on a PeopleSoft application. It appears that integration broker messages are being processed out of order. There is another possibility, and that is that the commit is being fired asynchronously, allowing the transactions to complete out of order. There are many inserts of detail records, followed by a trail...

How to get multiple records against one record based on relation?

I have two tables Organisation and Employee having one to many relation i.e one organisation can have multiple employees. Now I want to select all information of a particular organisation plus first name of all employees for this organisation. What’s the best way to do it? Can I get all of this in single record set or I will have to get ...

Problem with MS Access, the clipboard and something called Biff5!

Hi, I have a legacy app I am currently supporting that is having problems when people copy large quantities of data from a datasheet view. The App is built in MS Access and the amount of rows being copied can get pretty large (sometimes in the thousands). The funny thing about it is, you can paste the data out, but then Access keep...

Database safety: Intermediary "to_be_deleted" column/table?

Everyone has accidentally forgotten the WHERE clause on a DELETE query and blasted some un-backed up data once or twice. I was pondering that problem, and I was wondering if the solution I came up with is practical. What if, in place of actual DELETE queries, the application and maintenance scripts did something like: UPDATE foo SET t...

Handling different ConnectionStates before opening SqlConnection

If you need to open a SqlConnection before issuing queries, can you simply handle all non-Open ConnectionStates in the same way? For example: if (connection.State != ConnectionState.Open) { connection.Open(); } I read somewhere that for ConnectionState.Broken the connection needs to be closed before its re-opened....

What's the best database access pattern for testability?

I've read about and dabbled with some including active record, repository, data transfer objects. Which is best? ...