28.01.2013 Views

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Postcode 1 Postcode 2 Score Remarks<br />

GB-A1H 2ZU Gb-a1h2zu 1.0<br />

XX-12345 YY-12345 1.0 Invalid country codes<br />

are 'equal'<br />

D-12345 YY-12345 0.96 Valid and invalid<br />

SQL Syntax<br />

country code<br />

(N)VARCHAR columns have to be defined as postcode columns to enable the fuzzy postcode search. You do this<br />

by using the FUZZY SEARCH MODE clause.<br />

In addition, it is also possible to increase the performance of the postcode search by activating a fuzzy search<br />

index and by creating a database index on the postcode column.<br />

CREATE COLUMN TABLE tab<br />

(<br />

id INTEGER PRIMARY KEY,<br />

postcode NVARCHAR(20) FUZZY SEARCH INDEX ON FUZZY SEARCH MODE<br />

'postcode'<br />

);<br />

CREATE INDEX myindex1 ON tab(postcode);<br />

The postcode search can be enabled or disabled at a later point in time with the ALTER TABLE statement. Do not<br />

specify the FUZZY SEARCH MODE clause to disable the postcode search.<br />

-- enable postcode search<br />

ALTER TABLE tab ALTER<br />

(<br />

postcode NVARCHAR(100) FUZZY SEARCH MODE 'postcode'<br />

);<br />

-- disable postcode search<br />

ALTER TABLE tab ALTER<br />

(<br />

postcode NVARCHAR(100) FUZZY SEARCH MODE NULL<br />

);<br />

-- do not change the status of the search mode<br />

ALTER TABLE tab ALTER<br />

(<br />

postcode NVARCHAR(100)<br />

);<br />

<strong>SAP</strong> <strong>HANA</strong> <strong>Developer</strong> <strong>Guide</strong><br />

Enabling Search<br />

P U B L I C<br />

© 2012 <strong>SAP</strong> AG. All rights reserved. 279

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!