Friday 21 November 2008

Compare SQL Server and Oracle Numeric Data Types

Number data types aren't so easy to directly compare. Oracle has one main data type, NUMBER, which is equivilent to SqlServer NUMERIC.













SQL Server Oracle
NUMERIC / DECIMAL Maximum precision of 38 digits NUMBER Maximum precision of 38 digits


SqlServer also has number data types that are sized in bytes not precision, which have no direct equivalent in Oracle.












Data TypeMinMaxBytesNear Oracle Equivalent
BIGINT-9,223,372,036,854,775,8089,223,372,036,854,775,8078BINARY_DOUBLE
INT-2,147,483,6482,147,483,6474BINARY_FLOAT
SMALLINT-32,76832,7672NUMBER(5,0)
TINYINT02551NUMBER(3,0)
FLOAT-1.79E+308 to -2.23E-308, 0 and 2.23E-308 to 1.79E+3084 or 8BINARY_DOUBLE
REAL-3.40E+38 to -1.18E-38, 0 and 1.18E-38 to 3.40E+384BINARY_FLOAT
MONEY-922,337,203,685,477.5808922,337,203,685,477.58078NUMBER(19,4)
SMALLMONEY-214,748.3648214,748.36474NUMBER(10,4)


Oracle also has data types FLOAT, DECIMAL and INTEGER, however these are ANSI synonyms which refer back to the NUMBER data type with specific precisions.

See also: Compare Lob Data Types, Compare Character Data Types

Thursday 20 November 2008

Compare SQL Server and Oracle LOB Data Types

Oracle and SQL Server data types do not always match exactly. This table compares SQL Server 2008 and Oracle 11g LOB data types.































SQL Server Oracle
VARCHAR(MAX) Variable length non-Unicode character data, up to 2,147,483,645 characters. CLOB Variable length non-Unicode character data, that can hold be up 8 terabytes of character data.
NVARCHAR(MAX) Variable length Unicode character data, up to 1,073,741,822 characters. NCLOB Variable length non-Unicode character data, that can hold be up 8 terabytes of character data. The maximum character length is dependent on the number of bytes of the national character set.
VARBINARY(MAX) Stores the binary objects in the database. Up to 2Gb in size. BLOB Stores unstructured binary data in the database, up to 8 terabytes in size.
VARBINARY(MAX) FILESTREAM Stores the large objects outside of the database, in the NTFS file system. Size limited only by the volume size of the file system. BFILE Stores unstructured binary data, up to 8 terabytes, in operating-system files outside the database



In SQL Server VARBINARY(MAX), VARCHAR(MAX) and NVARCHAR(MAX) data types store the data in the record, unless the data is over 8Kb. When it exceeds 8Kb its behaviour changes and it stores a LOB locator in the record and holds the data in a LOB elsewhere. This locator value and the location is all handled behind the scenes and is invisible to the user.
The Oracle CLOB data type can be defined to be stored within the record or have a LOB locator, along with other storage characteristics, when the object is created.

See also: Compare Character Data Types, Compare Numeric Data Types

Tuesday 18 November 2008

Compare SQL Server and Oracle Character Data Types

Oracle and SQL Server data types do not always match exactly. This table compares SQL Server 2008 and Oracle 11g character data types.











































SQL Server Oracle
CHAR Fixed length non-Unicode character data. Can be specified up to 8000 characters CHAR Fixed length non-Unicode character data. Can be specified up to 4000 characters
NCHAR Fixed length Unicode character data. Can be specified up to 4000 characters NCHAR Fixed length Unicode character data. Maximum of 2000 bytes, the maximum character length is dependent on the number of bytes of the national character set.
VARCHAR Variable length non-Unicode character data. Can be specified up to 8,000 characters. VARCHAR2 Variable length non-Unicode character data. Can be specified up to 4,000 characters. The VARCHAR data type is synonymous with the VARCHAR2 data type.
VARCHAR(MAX) Variable length non-Unicode character data, up to 2,147,483,645 characters. CLOB Variable length non-Unicode character data, that can hold be up 8 terabytes of character data.
NVARCHAR Variable length Unicode character data. Can be specified up to 4,000 characters. NVARCHAR2 Variable length Unicode character data. Maximum of 4000 bytes, the maximum character length is dependent on the number of bytes of the national character set.
NVARCHAR(MAX) Variable length Unicode character data, up to 1,073,741,822 characters. NCLOB Variable length non-Unicode character data, that can hold be up 8 terabytes of character data. The maximum character length is dependent on the number of bytes of the national character set.



"N” Data Types

For both SQL Server and Oracle, each character data type has a corresponding “N” data type, which use multi-byte character sets, allowing a larger number of different characters. This is useful for non-alphabetic languages.
This means that the size in bytes is no longer equal to the length in characters, so the maximum length is often less.
In Oracle the database character set controls the character set of CHAR, VARCHAR2 and CLOB data types. The national character set controls the character set of NCHAR, NVARCHAR2 and NCLOB data types.

SQL Server TEXT and NTEXT Data Types

SQL Server includes TEXT and NTEXT data types which may be removed in a future version. Developers should use VARCHAR(MAX) or NVARCHAR(MAX) instead.
By default the TEXT and NTEXT data types store a LOB locator in the record, and hold the actual text value in a LOB elsewhere.

LOB Data Types

The SQL Server VARCHAR(MAX) and NVARCHAR(MAX) data types store the text value in the record, unless the text is over 8,000 bytes, as a normal VARCHAR would. When it exceeds 8000 bytes its behaviour changes and it stores a LOB locator in the record and holds the text in a LOB elsewhere, like the older TEXT data type.
The Oracle CLOB data type can be defined to be stored within the record or have a LOB locator, along with other storage characteristics, when the object is created.

LONG Data Type

Oracle includes a LONG data type, which has been included for backward compatibility since Oracle 8, when the CLOB data type was introduced. The CLOB data type should always be used instead of a LONG.

See also: Compare Lob Data Types, Compare Numeric Data Types

Monday 17 November 2008

CSS Common Font Families

As web users use different operating systems with different fonts installed, the font specified for a web page may not be installed, so the page may not always look as it was intended.
The CSS font-family property allows you to specify multiple fonts. The browser will try to use the first font in the list. If it is not installed it will use the next and so on.
The following lists try to replace fonts with similar fonts on Windows, Apple and Unix, or on older versions of the operating systems which may still be in use and may not have the newer fonts.

Sans Serif
Simplier fonts used mainly for on-screen text

Arial, Helvetica, sans-serif
'Arial Black', Gadget, sans-serif
Tahoma, Geneva, Arial, sans-serif
'Trebuchet MS', Helvetica, Arial, sans-serif
Verdana, Geneva, sans-serif

Serif
Roman fonts used mainly for headlines and printed material.

Georgia, Utopia, Palatino, 'Palatino Linotype', serif
Times New Roman, Times, serif

Monospace
Fixed width fonts, used mainly for computer code.

'Courier New', Courier, monospace
Lucida Console, Monaco, 'Courier New', monospace


Done.

Friday 7 November 2008

Fade Images Even When You Don't Have Access To PhotoShop

This is a little piece of cobbled together code, that I created when I didn't have access to any decent image editing software. I wanted to fade an image to use as background, hard with just Paint!
This is a rough and ready solution.

It uses HTML and CSS opacity property, which I can then screen grab and crop.

Edit the property values as appropriate.

<html>
<head>
<style>

div {
position: absolute;
top: 0px;
left: 0px;
width: 1000px;
height: 1000px;
opacity: 0.5;
filter: alpha(opacity=50);
background: white;
}


</style>
</head>

<body>

<img src="MyImage.jpg"/>
<div>
</div>

</body>


</html>

Faded.