Download presentation
Presentation is loading. Please wait.
1
MapInfo SQL String Functions
Hello good day my name is Rob Tozier and I will be speaking to you about MapInfo SQL String Functions. 17th Annual GeoElections Conference
2
17th Annual GeoElections Conference
MapInfo SQL String Functions InStr( num , str1 , str2 ) Proper$( str ) Len( str ) Left$( str , num ) Str$( obj ) Right$( str , num ) Val( str ) Mid$( str,num1, num2 ) LCase$( str ) LTrim$( str ) UCase$( str ) RTrim$( str ) The following are a list of SQL String Functions within MapInfo that are most commonly used. When using these functions you are typically performing one of 3 actions, Update Column, Table Maintenance, and/or SQL Query. 17th Annual GeoElections Conference
3
17th Annual GeoElections Conference
MapInfo SQL String Functions Arguments Found in MapInfo SQL Functions: Str – is a string of text, which can be a table column or a value that is located in the column. Num – is an number, which is commonly referring to a character position on a line of text. OBJ – is an object, used when selecting an object. Such as point, a line or a polyline. When using the SQL String Functions there are arguments that are required in order to run the functions. I will demonstrate how they are used later. The first one is a string(STR). A Str is a line of text that can either be a table column name or a value that falls in one of the rows within the column. The second is a Number(Num). A Num usually is referring to a character position on a within a line of text. The third is an object(OBJ). An OBJ is an object within a map such as a point, line, and/or polyline. In some instances you may want to query out just points in a map that has a mix of points and lines and polylines. 17th Annual GeoElections Conference
4
17th Annual GeoElections Conference
MapInfo SQL String Functions InStr( num , str1 , str2 ) When string contains a substring, InStr returns the character position where substring starts. Note: When string does not contain substring, InStr returns zero. The Instring(InStr) function is used to select a str of text within a column. For example if you had a list of addresses containing North Main Street and the way it was entered into your VR 2 different ways. One being spelled out as North and the other being abbreviated with the letter N. You could use the InStr() to select out all Main Streets and fix the ones where they were abbreviated. 17th Annual GeoElections Conference
5
17th Annual GeoElections Conference
MapInfo SQL String Functions Len( str ) Returns the number of characters in a str. The length function is used to determine the length of a string, which can be useful when adjusting field lengths in table maintenance. It can also be useful when combined with other functions to determine position. 17th Annual GeoElections Conference
6
17th Annual GeoElections Conference
MapInfo SQL String Functions Val( str ) Returns the numeric value of the str. The column you are update with the Val must be an integer and it will only be updated with numerics that are in the beginning of the address. for example, If you wanted to update a column with just the address number you can parse out the address number from an address using val(Address). 17th Annual GeoElections Conference
7
17th Annual GeoElections Conference
MapInfo SQL String Functions LCase$( str ) Returns an lowercase (all capitalized) version of str. The Lower Case (LCase$(Str)) function will lowercase all the text in a column. 17th Annual GeoElections Conference
8
17th Annual GeoElections Conference
MapInfo SQL String Functions UCase$( str ) Returns an uppercase (all capitalized) version of str. The Upper Case (UCase$(Str)) function will Uppercase all the text in a column. 17th Annual GeoElections Conference
9
17th Annual GeoElections Conference
MapInfo SQL String Functions Proper$( str ) Returns a str with proper capitalization (first letter of each word capitalized). The Proper (Proper$(Str)) function will capitalize the first letter of all the text in a column. So if you have 2 words in a cell that falls within the column it will capitalize both not just the first word like how the upper case function would. 17th Annual GeoElections Conference
10
17th Annual GeoElections Conference
MapInfo SQL String Functions Left$( str , num ) Returns the num specified of characters starting on the left of the str. The Left(left$) is usually used with an update column. When you are trying to take part of a string starting on the left hand side and it returns a specified amount of characters. 17th Annual GeoElections Conference
11
17th Annual GeoElections Conference
MapInfo SQL String Functions Right$( str , num ) Returns the num specified of characters starting on the right of the str. The Right(Right$) is usually used with an update column. When you are trying to take part of a string starting on the right hand side and it returns a specified amount of characters. 17th Annual GeoElections Conference
12
17th Annual GeoElections Conference
MapInfo SQL String Functions Mid$( str,num1, num2 ) Returns a portion of the str starting at character position num1 and extending for position num2 characters. The Mid(mid$) is usually used with an update column. When you are trying to take part of a string starting in the middle and it returns a specified amount of characters. Mid$(City_State_Zip, InStr(1,City_State_Zip,",")+1,InStr(InStr(1,City_State_Zip,",")+1, City_State_Zip,",")-1) Alternatively I could have done it an easier way using. Mid$(City_State_Zip, InStr(1,City_State_Zip,",")+1, Val(City_State_Zip)-5) 17th Annual GeoElections Conference
13
17th Annual GeoElections Conference
MapInfo SQL String Functions LTrim$( str ) Trims any spaces from the start of str and returns result. RTrim$( str ) Trims any spaces from the end of str and returns result. The left (LTrim$) and right (RTrim$) trim function are used when trying to remove spaces before and after a string in a specified column. This is usually preformed when you import data from an external source. 17th Annual GeoElections Conference
14
15th Annual GeoElections Conference
MapInfo SQL String Functions 15th Annual GeoElections Conference
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.