July 26, 2006

Changing Column Names in Oracle

Oracle does not have a mechanism by which you directly change column names. But this workaround is quick and efficient. Consider TableA: COLUMN_1 NUMBERCOLUMN_2 VARCHAR2(500)COLUMN_3 DATE You want to change it to TableB: NEW_COLUMN_1 NUMBERNEW_COLUMN_2 VARCHAR2(500)NEW_COLUMN_3 DATE then use the following SQL. CREATE TABLE TableB (NEW_COLUMN_1, NEW_COLUMN_2, NEW_COLUMN_3) AS SELECT

Using XMLSchema DOM and SAX in JAXP 1.2

To take advantage of the power of XMLSchema in a SAX or DOM application, you simply have to set two properties. In JAXP 1.3, use the javax.xml.validation package. The two properties are: http://java.sun.com/xml/jaxp/properties/schemaLanguagehttp://java.sun.com/xml/jaxp/properties/schemaSource In a “SAX application”: …SAXParserFactory SAXpf=SAXParserFactory.newInstance();… SAXpf.setNamespaceAware(true); SAXpf.setValidating(true); …SAXParser SAXparser=SAXpf.newSAXParser(); …try{ SAXparser.setProperty (“http://java.sun.com/xml/jaxp/properties/schemaLanguage”, “http://www.w3.org/2001/XMLSchema”);}catch (SAXNotRecognizedException e) {

Add a Fresh Set of Records to a Dataset

When you execute a new query and populate an existing dataset, the newly retrieved records are appended to the existing records in the dataset. If you wish to remove the earlier records from the dataset without creating a new dataset, simply use its Clear() method. This will remove the earlier

Avoid the Diamond Problem when Using Inheritance in Loops

While multiple inheritance is an extremely useful feature?escpecially in large scale software, it can also lead to a problem known as the DDD, or “Dreadful Diamond on Derivation,” or simply “The Diamond Problem,” shown in the following code: class ElectricAppliance{ int voltage, public: int getVoltage ( ) const { return

Quick Ways to Determine a Computer’s Name

Here are three quick ways to determine a computer’s name: Type Hostname in the Command Prompt, then press the Enter key. Press the Windows and Pause keys to bring up the System Properties dialog. Select the Computer Name tab to find the name. Go to Control Panel?>Performance and Maintenance?>System. Select

Avoid These Common Business Rule Implementation Mistakes

ow many times have you seen this scenario: SQL Server developers understand business rules, yet when they try to use triggers and constraints to implement them the database ends up containing some invalid data?which could have dire consequences for a business? Over the years, I have seen such situations many