database

Better way to structure a PL/SQL IF THEN statement ?

Just wondering if there is a better way to write the following PL/SQL piece of code in ORACLE ? IF(p_c_courtesies_cd is not null OR p_c_language_cd is not null OR v_c_name is not null OR v_c_firstname is not null OR v_c_function is not null OR p_c_phone is not null OR p_c_mobile is not null OR p_c_fax is not null OR v_c_email is not n...

Best way to optimize dataset that contains linestrings. Some lines start and end at same coordinates.

THE SETUP I have a table which contains linestrings. Linestrings are made up of multiple geographic points. Each point is made up of a latitude and longitude. Note: the linestring value is stored as TEXT in the database. So one row in the table might look like this: id: an integer linestring: x1, y2, x2, y2, x3, y3, x4, y4 THE PROBLEM ...

InvalidOperationException

Has anyone encountered this error using SQL Server 2005 and Data access application blocks in a failover configuration? "InvalidOperationException Framework Data Provider Error 6" It seems to occur in our server application at irregular intervals and more frequently when SQL Server is in failover config? While doing some research I s...

Java Embedded Databases Comparison

I intend to develop a small (Java) application for managing my finances. I believe I need to use an embedded database, but I have no experience regarding this issue. I tried to look at some of the available products, but I can't decide which one would be more suitable for me. H2, HSQLDB, Derby and Berkeley DB seem to be good candidates, ...

Dataset Update Filter Location

This has always bugged me to what is the best way to do the following... with a simple one to many db, when you have 2 tables/grids on a form and the 2nd one filtered by the first. where is the best place to put the filter code ie: procedure TForm1.tblCustormersAfterScroll(DataSet: TDataSet); begin if tblCustormersCustormerID.AsS...

What is a better way to create an access database of file names using C++ Builder?

Final question for the night. And apologies for the complete noobness of this. I have, with help from stackoverflow and google achieved the following... void __fastcall TForm1::Button1Click(TObject *Sender) { ADOCommand1->CommandText = "drop table pictures purge"; ADOCommand1->Execute(); ADOCommand1->CommandText = "create table pic...

.Net PostgreSQL Connection String

I am using PostgreSQL in a project I am working on, and one of the queries is timing out. I need to increase the timeout on the database connection, but since I am using my DAO through a complex wrapper to Active Record and NHibernate, I am not able to adjust the timeout of the command object - so I am hoping you can change the timeout ...

How much of an applications "smarts" should reside in the database?

I've noticed a trend lately that people are moving more and more processing out of databases and in to applications. Some people are taking this to what seems to me to be ridiculous extremes. I've seen application designs that not only banned all use of stored procedures, but also banned any kind of constraints enforced at the databa...

How to create empty local databases based on an existing .sdf file on VS2008 and SQL Server Compact

I'd like to use Visual Studio 2008 IDE for editing my local database schema for a SQL Server Compact 3.5 database. However, everything in the documentation and in the UI seems to make an assumption that the application/assembly only wants to use a single database and never wishes to create new ones based on the existing schema. I'd lik...

Scrub all records in a SQL database...

I was wondering what you would use to scrub a database of all test data (leaving the structure intact) prior to going into production? I use something like: -- disable referential integrity EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL' GO EXEC sp_MSForEachTable ' IF OBJECTPROPERTY(object_id(''?''), ''TableHasForeignRe...

Dropping Leading Zeros

I have a form that records a student ID number. Some of those numbers contain a leading zero. When the number gets recorded into the database it drops the leading 0. The field is set up to only accept numbers. The length of the student ID varies. I need the field to be recorded and displayed with the leading zero. ...

Use data with variable structure

Imagine a system that works with data, which structure changes over time. Say, for example, today your User object contains Name : String and Email : String, but tomorrow you need to add Age : Integer and Address which consists of Country, Zip code, etc. Then you may want to create new field User.Contacts and move Email and Address to th...

What is the best approach for decoupled database design in terms of data sharing?

I have a series of Oracle databases that need to access each other's data. The most efficient way to do this is to use database links - setting up a few database links I can get data from A to B with the minimum of fuss. The problem for me is that you end up with a tightly-coupled design and if one database goes down it can bring the cou...

SQL Server - What's the best way to change a PK data type?

Hello all, I've currently got a database with about 20 reference tables, i.e. stuff like products, assets, depots, users, etc. This information is stored in a central database and is downloaded to PDAs of engineers who are out on the road. Every table in my database has a PK of UniqueIdentifier (i.e. a GUID). I've realised after 2 year...

Any reason to use DataSets with Local Databases with SQL Server Compact?

Does it make sense to use .NET DataSets even in applications that use a local in-process database for application data persistence? If DataSets are mainly meant for in-memory caching of database results, it sounds like they're not so beneficial when using something like SQL Server Compact local database that runs in the same process as ...

How can I find if a column is auto_increment in mysql?

I'm trying to inspect my mysql database information_schema to find out the attributes of the columns. I can't find where the details as to which columns are auto_increment. Does anyone know where I can find this info in the information_schema DB? ...

How do I ALTER a PostgreSQL table and make a column unique?

I have a table in PostgreSQL where the schema looks like this: CREATE TABLE "foo_table" ( "id" serial NOT NULL PRIMARY KEY, "permalink" varchar(200) NOT NULL, "text" varchar(512) NOT NULL, "timestamp" timestamp with time zone NOT NULL ) Now I want to make the permalink unique across the table by ALTER-ing the table. Ca...

Any SQL database: When is it better to fetch a whole table instead of querying for particular rows?

I have a table that contains maybe 10k to 100k rows and I need varying sets of up to 1 or 2 thousand rows, but often enough a lot less. I want these queries to be as fast as possible and I would like to know which approach is generally smarter: Always query for exactly the rows I need with a WHERE clause that's different all the time. ...

Web Application Architecture: Future Proofing

Hello all, I have a web application that currently sends emails. At the time my web applications sends emails (sending of emails is based on user actions - not automatic), it has to run other processes like zipping up files. I am trying to make my application "future proof" - so when there are a large number of users I don't want the ...

Tools to convert Microsoft Access to an online PHP/mySQL system

We have a Microsoft Access database that has been used for many years. Our staff is very used to using the Access tables and forms to query, view, update and add to the data. But the database is at the end of its lifetime. We want to convert it to a PHP/mySQL solution. I have found tools that can convert the Access database to mySQL. ...