20
Insensitive – Not a Bad Thing for Data Noreen Redden Information Builders

Insensitive – Not a Bad Thing for Data

  • Upload
    etana

  • View
    25

  • Download
    0

Embed Size (px)

DESCRIPTION

Insensitive – Not a Bad Thing for Data. Noreen Redden Information Builders. Why Case Insensitivity Two Worlds. Why ? How? Problem?. Why Case Insensitivity Two Worlds: Selection. SQL SELECT T1. " LN " ,T1. " FN “ ,T1. " PAY " FROM master.dbo.EMPSQL T1 - PowerPoint PPT Presentation

Citation preview

Page 1: Insensitive – Not a Bad Thing for Data

Insensitive – Not a Bad Thing for Data

Noreen Redden

Information Builders

Page 2: Insensitive – Not a Bad Thing for Data

Why Case InsensitivityTwo Worlds

Why ?

How?

Problem?

Page 3: Insensitive – Not a Bad Thing for Data

TABLE FILE EMPSQLPRINT LN FN PAYWHERE LN EQ 'deFazio'END

SQLSELECT T1."LN",T1."FN“,T1. "PAY"FROM master.dbo.EMPSQL T1 WHERE (T1. "LN" = 'deFazio‘);

Why Case InsensitivityTwo Worlds: Selection

DEFAZIO ANTHONY 10,000deFazio Anthony 10,000DeFazio Anthony 10,000

deFazio Anthony 10,000

Page 4: Insensitive – Not a Bad Thing for Data

TABLE FILE EMPSQLPRINT LN FN PAYWHERE UPCASE(15,LN, 'A15‘) EQ ‘DEFAZIO'END

SQLSELECT T1."LN",T1."FN",T1.CDEPT,T1."CDIV",T1.PAYFROM master.dbo.EMPSQL T1

Why Case InsensitivityTwo Worlds: Selection – NOT Optimized

DEFAZIO ANTHONY 10,000deFazio Anthony 10,000DeFazio Anthony 10,000

Page 5: Insensitive – Not a Bad Thing for Data

TABLE FILE EMPSQLSUM PAY BY LN BY FNWHERE LN EQ 'deFazio'END

Why Case InsensitivityTwo Worlds: Selection

DEFAZIO ANTHONY 30,000

SQLSELECT T1."LN",T1."FN", SUM(T1."PAY“)FROM master.dbo.EMPSQL T1 WHERE (T1. "LN" = 'deFazio‘)GROUP BY T1."LN",T1."FN“ORDER BY T1."LN",T1."FN";

Page 6: Insensitive – Not a Bad Thing for Data

TABLE FILE EMPSQLPRINT FN PAY BY LN WHERE UPCASE(15,LN, 'A15‘) EQ ‘DEFAZIO' OR ‘FAZIO'END

Why Case InsensitivityTwo Worlds: Sorting

DEFAZIO ANTHONY 10,000DeFazio Anthony 10,000FAZIO Anthony 9,000Fazio Anthony 11,000deFazio Anthony 10,000Fazio Anthony 10,000

Page 7: Insensitive – Not a Bad Thing for Data

COLLATION

Collation is defined as a set of rules that apply to the ordering and matching of all language elements that

involve comparison of two values

Why ?

How?

Problem?

Page 8: Insensitive – Not a Bad Thing for Data

• BINARYBINARY Bases collation sequence on binary valuesBases collation sequence on binary values

• SRV_CISRV_CI Bases collation sequence on LANGUAGEBases collation sequence on LANGUAGE

Setting, and is INSENSITIVESetting, and is INSENSITIVE

• SRV_CSSRV_CS Bases collation sequence on LANGUAGEBases collation sequence on LANGUAGE

Setting and is SENSITIVESetting and is SENSITIVE

• CODEPAGECODEPAGE Bases collation on the code page in effect, and is Bases collation on the code page in effect, and is

SENSITIVE.SENSITIVE.

SET COLLATION = BINARY SRV_CI SRV_CS CODEPAGE

Collation is SettableRelease 7.7

Page 9: Insensitive – Not a Bad Thing for Data

Collation is SettableRelease 7.7

EBCDIC ASCII

SENSITIVE > <

INSENSITIVE = =

A ? a

EBCDIC ASCII

SENSITIVE > <

INSENSITIVE < <

A ? b

EBCDIC ASCII

SENSITIVE > <

INSENSITIVE > <

1 ? A

Page 10: Insensitive – Not a Bad Thing for Data

TABLE FILE EMPSQLPRINT LN FN PAYWHERE LN EQ 'deFazio'END

SQLSELECT T1."LN",T1."FN“,T1. "PAY"FROM master.dbo.EMPSQL T1 WHERE (T1. "LN" = 'deFazio‘);

DEFAZIO ANTHONY 10,000deFazio Anthony 10,000DeFazio Anthony 10,000

Insensitive ServerSelection

Page 11: Insensitive – Not a Bad Thing for Data

TABLE FILE EMPSQLPRINT LN FN PAY BY LN WHERE LN EQ ‘DeFazio' OR ‘Fazio'END

Insensitive ServerSorting

DEFAZIO DEFAZIO ANTHONY 10,000 DeFazio Anthony 10,000 deFazio Anthony 10,000

Fazio Fazio Anthony 11,000 FAZIO Anthony 9,000 Fazio Anthony 10,000

Page 12: Insensitive – Not a Bad Thing for Data

Selection

Why ?

How?

Problem?

Page 13: Insensitive – Not a Bad Thing for Data

TABLE FILE EMPSQLPRINT PAY BY LN BY FNWHERE LN EQ ‘defazio’ OR ‘fazio’ OR ‘deanna’ON TABLE HOLD AS TEMP FORMAT ALPHAEND

Insensitive ServerTemporary Files - FIXRETRIEVE

Deanna Maria 25,000DEFAZIO ANTHONY 10,000DEFAZIO Anthony 10,000DEFAZIO Anthony 10,000Fazio Anthony 11,000Fazio Anthony 9,000Fazio Anthony 10,000

Page 14: Insensitive – Not a Bad Thing for Data

TABLE FILE TEMPPRINT PAY BY LN BY FNWHERE LN EQ ‘defazio’END

Insensitive ServerTemporary Files

Deanna Maria 25,000DEFAZIO ANTHONY 10,000DEFAZIO Anthony 10,000DEFAZIO Anthony 10,000Fazio Anthony 11,000Fazio Anthony 9,000Fazio Anthony 10,000

FIXRETRIEVE Would

STOP here.

If Server is set Case INSENSITIVEWHERE test is on an alpha “key”FIXRETRIEVE is set OFF

Page 15: Insensitive – Not a Bad Thing for Data

TABLE FILE EMPSQLPRINT PAY BY LN BY FNWHERE LN EQ ‘defazio’ OR ‘fazio’ OR ‘deanna’ON TABLE HOLD AS TEMP1 FORMAT ALPHAEND

Insensitive ServerJOIN

Deanna Maria 25,000DEFAZIO ANTHONY 10,000DEFAZIO Anthony 10,000DEFAZIO Anthony 10,000Fazio Anthony 11,000Fazio Anthony 9,000Fazio Anthony 10,000

Page 16: Insensitive – Not a Bad Thing for Data

TABLE FILE EMP2 PRINT *END

Insensitive ServerJOIN

deanna Maria 25,000fazio Anthony 11,000samuels Joseph 15,000 DEFAZIO ANTHONY 10,000

EMP2 file created in prior release (Case Sensitive)

Page 17: Insensitive – Not a Bad Thing for Data

JOIN LN IN EMP2 TO MULTIPLE LN IN TEMP AS AJTABLE FILE EMP2 PRINT *END

Insensitive Server

JOIN to a Sequential File: Both files Must be in ascending order on COMMON KEY Correct sequence is determined by setting of collation.

TABLE FILE EMP2 PRINT * BY LN ON TABLE HOLD AS EMP3 FORMAT FOCUS INDEX LNENDJOIN LN IN EMP3 TO MULTIPLE LN IN TEMP AS AJTABLE FILE EMP3 PRINT *END

Page 18: Insensitive – Not a Bad Thing for Data

Insensitive Server

• JOIN to FOCUS/FIX files to be reliable must•Use numeric keys•Use Keys that follow a specific pattern: Unnn •Have been created using the same collation sequence.

• JOIN to (or selection from) case sensitive files to be reliable must•Use numeric keys•Use Keys that follow a specific pattern: Unnn •Avoid indexes for selection.

Page 19: Insensitive – Not a Bad Thing for Data

The Sensitive WorldCome in and Stay

Set it

And

Forget

it

Page 20: Insensitive – Not a Bad Thing for Data

The Sensitive WorldCome in and Stay

Why ?

How?

Problem?

What’s Next ?