database

PHP and MS Access: Number of Records returned by SELECT query

I am running following PHP code to interact with a MS Access database. $odbc_con = new COM("ADODB.Connection"); $constr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . $db_path . ";"; $odbc_con -> open($constr); $rs_select = $odbc_con -> execute ("SELECT * FROM Main"); Using ($rs_select -> RecordCount) gives -1 though the query ...

How do I attach a MSSQL 2000 database with only an MDF file.

I have an old server with a defunct evaluation version of SQL 2000 on it (from 2006), and two databases which were sitting on it. For some unknown reason, the LDF log files are missing. Presumed deleted. I have the mdf files (and in one case an ndf file too) for the databases which used to exist on that server, and I am trying to get t...

Find two consecutive rows

I'm trying to write a query that will pull back the two most recent rows from the Bill table where the Estimated flag is true. The catch is that these need to be consecutive bills. To put it shortly, I need to enter a row in another table if a Bill has been estimated for the last two bill cycles. I'd like to do this without a cursor, ...

In which cases do you test against an In-Memory Database instead of a Development Database?

When do you test against an In-Memory Database vs. a Development Database? Also, as a related side question, when you do use a Development Database, do you use an Individual Development Database, an Integration Development Database, or both? Also++, for unit testing, when do you use an In-Memory Database over mocking out your Reposito...

Sample sql script to zip and transfer database backup file

I was looking for a sample sql script to zip my database backup file (.bak) and transfer to a remote location. Please share if you have it with you. ...

Extreme Sharding: One SQLite Database Per User

I'm working on a web app that is somewhere between an email service and a social network. I feel it has the potential to grow really big in the future, so I'm concerned about scalability. Instead of using one centralized MySQL/InnoDB database and then partitioning it when that time comes, I've decided to create a separate SQLite databa...

Profiling SQL Server and/or ASP.NET

How would one go about profiling a few queries that are being run from an ASP.NET application? There is some software where I work that runs extremely slow because of the database (I think). The tables have indexes but it still drags because it's working with so much data. How can I profile to see where I can make a few minor improvement...

How to implement a company-internal icon gallery

I love writing my own web-based applications, but don't want to succumb to the not invented here syndrome. So before I go write this myself, I'm looking for solutions that either do this, or perhaps frameworks (like Django or Joomla, etc.) that give me a starting point fairly close to what I need. My company produces software with a la...

Can you use Decision Tables in Relational Databases

I heard that decision tables in relational database have been researched a lot in academia. I also know that business rules engines use decision tables and that many BPMS use them as well. I was wondering if people today use decision tables within their relational databases? ...

Planning to use PostgreSQL with ASP.NET: bad idea?

Hi everyone! I'm currently planning the infrastructure for my future web project. I want to go the way Joel went with having one DB per client and now thinking which DB engine will be good for me. The best would be of course SQL Server, but I can't afford a full-blown version at this moment and I don't think SQL Server Express will be a...

What's the SQL query to list all rows that have 2 column sub-rows as duplicates?

Ok I have a table that has redundant data and I'm trying to identify all rows that have duplicate sub-rows (for lack of a better word). By sub-rows I mean considering COL1 and COL2 only. So let's say I have something like this: COL1 COL2 COL3 --------------------- aa 111 blah_x aa 111 blah_j aa 112 blah_m...

Fetch one row per account id from list, part 2

Not sure how to ask a followup on SO, but this is in reference to an earlier question: http://stackoverflow.com/questions/94930/fetch-one-row-per-account-id-from-list The query I'm working with is: SELECT * FROM scores s1 WHERE accountid NOT IN (SELECT accountid FROM scores s2 WHERE s1.score < s2.score) ORDER BY score DESC This selec...

What's the quickest way to dump & load a MySQL InnoDB database using mysqldump?

I would like to create a copy of a database with approximately 40 InnoDB tables and around 1.5GB of data with mysqldump and MySQL 5.1. What are the best parameters (ie: --single-transaction) that will result in the quickest dump and load of the data? As well, when loading the data into the second DB, is it quicker to: 1) pipe the resu...

Sybase Developer Needs To Learn Oracle

I am pretty much a Sybase expert, an experienced developer, and very comfortable learning new stuff. I need to write a bunch of SQL to run against an Oracle database. Can someone recommend a book, training course or other resource to give me what I need to know in the shortest possible time? I don't need Oracle for Dummies, but someth...

.NET: SqlDataReader.Close or .Dispose results in Timeout Expired exception

When trying to call Close or Dispose on an SqlDataReader i get a timeout expired exception. If you have a DbConnection to SQL Server, you can reproduce it yourself with: String CRLF = "\r\n"; String sql = "SELECT * " + CRLF + "FROM (" + CRLF + " SELECT (a.Number * 256) + b.Number AS Number" + CRLF + " FROM master..spt_v...

How do you handle small sets of data?

With really small sets of data, the policy where I work is generally to stick them into text files, but in my experience this can be a development headache. Data generally comes from the database and when it doesn't, the process involved in setting it/storing it is generally hidden in the code. With the database you can generally see all...

MS Access Data Access Limitations

I have a project right now where I'd like to be able to pull rows out of an Access database that a 3rd party product uses to store its information. There will likely be a small number of users hitting this database at the same time my "export" process does, so I'm a little concerned about data integrity and concurrent access. Will I li...

How can I leverage an ORM for a database whose schema is unknown until runtime?

I am trying to leverage ORM given the following requirements: 1) Using .NET Framework (latest Framework is okay) 2) Must be able to use Sybase, Oracle, MSSQL interchangeably 3) The schema is mostly static, BUT there are dynamic parts. I am somewhat familiar with SubSonic and NHibernate, but not deeply. I get the nagging feeling that th...

How can I create database tables from XSD files?

I have a set of XSDs from which I generate data access classes, stored procedures and more. What I don't have is a way to generate database table from these - is there a tool that will generate the DDL statements for me? This is not the same as Create DB table from dataset table, as I do not have dataset tables, but XSDs. ...

Creating an online catalogue using Drupal, what are the best modules/techniques?

I have a large collection of retro games consoles and computers, I want to create some sort of catalogue to keep track of them using Drupal. I could do it as a series of pages in Drupal, but would rather have some sort of more structured method. It'd be great if I could somehow define a record consisting of certain fields (manufacturer,...