2sqltechnical reference guide · cu2 global pty ltd convertu2 technologies the global data...
TRANSCRIPT
CU2 Global Pty Ltd ConvertU2 Technologies The Global Data Conversion Experts The Data and Software Conversion Experts
2SQLTechnical Reference Guide
Version 5.4.0
February 2014
© 2014 ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd. All rights
reserved.
ConvertU2, CU2, and 2SQL are either registered trademarks or trademarks of ConvertU2 Technologies Pty Ltd in Australia, the United States and other countries. Access and SQL Server are trademarks of Microsoft Corporation.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 2
Table of Contents
INTRODUCTION .......................................................................................................................................................... 8
CONVERSION CATEGORIES BY COMPONENT .............................................................................................................. 9
TABLE SCHEMA (FIELD TYPES).............................................................................................................................................. 11
Text Field Types ........................................................................................................................................................ 11
Memo Field Types .................................................................................................................................................... 11
Date Field Types ....................................................................................................................................................... 11
Date Based Unique Indexes ...................................................................................................................................... 11
Boolean Field Types .................................................................................................................................................. 12
AutoNumber Field Types .......................................................................................................................................... 12
Integer Field Types ................................................................................................................................................... 12
Long Field Types ....................................................................................................................................................... 12
Decimal Field Types .................................................................................................................................................. 12
Long Binary Field Types ............................................................................................................................................ 12
GUID Field Types ...................................................................................................................................................... 12
Currency Field Types ................................................................................................................................................. 12
Single Field Types ..................................................................................................................................................... 12
Double Field Types ................................................................................................................................................... 12
Byte Field Types ........................................................................................................................................................ 12
Attachment Field Types ............................................................................................................................................ 12
TABLE SCHEMA (CONSTRAINTS) ........................................................................................................................................... 13
Table Relationship Field Size Conflicts ...................................................................................................................... 13
Table Relationship Field Type Conflicts .................................................................................................................... 13
Column Validation Rule Syntax ................................................................................................................................ 13
Column Default Value Syntax ................................................................................................................................... 14
Table Relationship Deletions .................................................................................................................................... 14
Column Format Properties ....................................................................................................................................... 14
InputMask Properties ............................................................................................................................................... 14
TimeStamp Columns ................................................................................................................................................ 14
Column DisplayControl Properties ........................................................................................................................... 14
Nullable Boolean Fields ............................................................................................................................................ 14
Nullable Boolean Fields without Default Value ........................................................................................................ 14
Memo Fields with Validation Rules .......................................................................................................................... 14
Disallow Zero Length String Constraints .................................................................................................................. 15
Disallow Zero Length Memo Constraints ................................................................................................................. 15
TABLE SCHEMA (INDEXES) ................................................................................................................................................... 16
Primary Key Indexes ................................................................................................................................................. 16
Unique Indexes ......................................................................................................................................................... 16
Non Unique Indexes ................................................................................................................................................. 16
Tables with Unique Index but no Primary Key .......................................................................................................... 16
Tables with no Unique Index and no AutoNumber .................................................................................................. 17
AutoNumber Tables with no Unique Index .............................................................................................................. 17
Clustered Indexes ..................................................................................................................................................... 17
Indexed Memo Fields ............................................................................................................................................... 17
Composite Primary Keys with Autonumbers ............................................................................................................ 17
Nullable Unique Indexes ........................................................................................................................................... 17
TABLE DATA ..................................................................................................................................................................... 18
Invalid Date Values .................................................................................................................................................. 18
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 3
Duplicate AutoNumbers ........................................................................................................................................... 18
Null AutoNumbers .................................................................................................................................................... 18
Unindexed Required Fields with Null Values ............................................................................................................ 19
Unique Indexed Required Fields with Null Values .................................................................................................... 19
Orphaned Table Relationship Records ..................................................................................................................... 19
Data Migration......................................................................................................................................................... 19
Table RowCount Reconciliation ................................................................................................................................ 19
SQL STATEMENTS (A TO E) ................................................................................................................................................. 20
Aggregate SELECTs ................................................................................................................................................... 20
Alias Name References ............................................................................................................................................. 21
Boolean Expressions ................................................................................................................................................. 21
Boolean Sorts ........................................................................................................................................................... 21
Bracketed Joins ........................................................................................................................................................ 21
Cartesian Joins ......................................................................................................................................................... 21
Crosstab Syntax ........................................................................................................................................................ 21
DATEADD String Comparisons.................................................................................................................................. 22
Date Based Comparisons ......................................................................................................................................... 22
Date based DISTINCTs .............................................................................................................................................. 22
Date Based GROUP BYs ............................................................................................................................................ 22
Date Based Joins ...................................................................................................................................................... 23
Date Expressions ...................................................................................................................................................... 23
Date Functions using Dynamic Interval Parameter .................................................................................................. 23
Date Functions using FirstDayOfWeek Parameter ................................................................................................... 23
DELETE Statement Syntax ........................................................................................................................................ 23
Deterministic BETWEEN Clause Comparisons .......................................................................................................... 23
DISTINCTs with Foreign ORDER BY Expressions ....................................................................................................... 24
DISTINCTROW Selects .............................................................................................................................................. 24
Double Quotation Usage .......................................................................................................................................... 24
Duplicate Column Aliases ......................................................................................................................................... 24
Duplicate ORDER and GROUP BY Expressions .......................................................................................................... 25
Dynamic Aliases ....................................................................................................................................................... 25
Encapsulated Table Column Expressions.................................................................................................................. 25
Exclamation Mark Usage ......................................................................................................................................... 25
EXISTS Functions with Boolean Reference ................................................................................................................ 25
SQL STATEMENTS (F TO N) ................................................................................................................................................. 26
Floating Point Divisions ............................................................................................................................................ 26
Functions Requiring Data Type Conversions ............................................................................................................ 27
Implicit SELECTs ........................................................................................................................................................ 27
HAVING Clauses with no GROUP BY Clause ............................................................................................................. 27
Implicit Sorts Using DISTINCT ................................................................................................................................... 27
Implied Boolean Comparisons .................................................................................................................................. 27
Implied Boolean Expressions .................................................................................................................................... 28
Implied Form/Report Control Input Parameters ...................................................................................................... 28
Implied Input Parameters ........................................................................................................................................ 28
Linked SubForms ...................................................................................................................................................... 28
MakeTable Statement Syntax .................................................................................................................................. 29
Memo based DISTINCTs ........................................................................................................................................... 29
Memo Based GROUP BYs ......................................................................................................................................... 29
Memo Based Function Parameters .......................................................................................................................... 29
Memo Based Joins .................................................................................................................................................... 30
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 4
Memo Based ORDER BYs .......................................................................................................................................... 30
Missing Keys in SELECT Clauses ................................................................................................................................ 30
MOD Operators ........................................................................................................................................................ 30
Multiple Object Updates .......................................................................................................................................... 30
Non Deterministic BETWEEN Clause Comparisons .................................................................................................. 31
Non Text Based Concatenations .............................................................................................................................. 31
Numeric Alias and Object Names ............................................................................................................................. 31
SQL STATEMENTS (O TO Z) ................................................................................................................................................ 32
OLE/HyperLink based DISTINCTs .............................................................................................................................. 32
OWNERACCESS OPTION ........................................................................................................................................... 32
Query Names Longer than 60 Characters in SQL ..................................................................................................... 33
Reserved Key Word Usage ....................................................................................................................................... 33
Rounded Divisions .................................................................................................................................................... 33
SELECTS requiring WITH TIES ................................................................................................................................... 33
SELECTs with ORDER BY ........................................................................................................................................... 33
Square Bracket SELECTs ........................................................................................................................................... 33
String Concatenation Symbols ................................................................................................................................. 33
Superfluous DISTINCTs ............................................................................................................................................. 33
Superfluous ORDER BY and GROUP BY expressions ................................................................................................. 33
Superfluous Semi Colons .......................................................................................................................................... 34
TABLE SELECT Clauses .............................................................................................................................................. 34
TimeStamp Column Exclusion .................................................................................................................................. 34
UNIONs with Object Name in ORDER BY Clause ...................................................................................................... 34
UNIONs with Superfluous ORDER BY Clause ............................................................................................................ 34
UPDATE Statement Syntax ....................................................................................................................................... 35
User Defined Input Parameters ................................................................................................................................ 35
Wildcard References ................................................................................................................................................ 35
XOR Operator ........................................................................................................................................................... 35
VBA FUNCTIONS (A TO D) .................................................................................................................................................. 36
ASC Function ............................................................................................................................................................ 36
CCUR Function .......................................................................................................................................................... 36
CDATE Function ........................................................................................................................................................ 36
CDBL Function .......................................................................................................................................................... 36
CHOOSE Function ..................................................................................................................................................... 37
CHR Function ............................................................................................................................................................ 37
CINT Function ........................................................................................................................................................... 37
CLNG Function .......................................................................................................................................................... 37
CSNG Function .......................................................................................................................................................... 37
CSTR Function ........................................................................................................................................................... 37
CURRENTUSER Function ........................................................................................................................................... 37
CVDATE Function ...................................................................................................................................................... 37
DATE Function .......................................................................................................................................................... 37
DATEADD Function ................................................................................................................................................... 37
DATEDIFF Function ................................................................................................................................................... 37
DATEPART Function.................................................................................................................................................. 38
DATESERIAL Function ............................................................................................................................................... 38
DATEVALUE Function ............................................................................................................................................... 38
DAVG Function ......................................................................................................................................................... 38
DAY Function ............................................................................................................................................................ 38
DCOUNT Function .................................................................................................................................................... 38
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 5
DLOOKUP Function ................................................................................................................................................... 38
DMAX Function ........................................................................................................................................................ 38
DMIN Function ......................................................................................................................................................... 39
DSUM Function ........................................................................................................................................................ 39
VBA FUNCTIONS (E TO M) ................................................................................................................................................. 40
FIRST Function .......................................................................................................................................................... 40
FIX Function .............................................................................................................................................................. 40
FORMAT Function .................................................................................................................................................... 40
FORMATCURRENCY Function ................................................................................................................................... 41
FORMATDATETIME Function ................................................................................................................................... 41
FORMATNUMBER Function ...................................................................................................................................... 41
FV Function .............................................................................................................................................................. 41
HOUR Function ......................................................................................................................................................... 41
IIF Function ............................................................................................................................................................... 41
INSTR Function ......................................................................................................................................................... 41
INSTRREV Function ................................................................................................................................................... 41
INT Function ............................................................................................................................................................. 41
IPMT Function .......................................................................................................................................................... 41
ISNULL Function ....................................................................................................................................................... 42
LAST Function ........................................................................................................................................................... 42
LCASE Function ......................................................................................................................................................... 42
LEFT Function ........................................................................................................................................................... 42
LEN Function ............................................................................................................................................................ 42
LTRIM Function ........................................................................................................................................................ 42
MID Function ............................................................................................................................................................ 42
MINUTE Function ..................................................................................................................................................... 42
MONTH Function ...................................................................................................................................................... 42
VBA FUNCTIONS (N TO Z) .................................................................................................................................................. 43
NOW Function .......................................................................................................................................................... 43
NZ Function .............................................................................................................................................................. 43
PARTITION Function ................................................................................................................................................. 44
PMT Function ........................................................................................................................................................... 44
PPMT Function ......................................................................................................................................................... 44
PV Function .............................................................................................................................................................. 44
RIGHT Function ........................................................................................................................................................ 44
ROUND Function ...................................................................................................................................................... 44
RND Function ........................................................................................................................................................... 44
RTRIM Function ........................................................................................................................................................ 44
SPACE Function ........................................................................................................................................................ 44
STR Function ............................................................................................................................................................. 44
STRCONV Function ................................................................................................................................................... 44
STRING Function ....................................................................................................................................................... 44
STRREVERSE Function............................................................................................................................................... 44
TIME Function .......................................................................................................................................................... 45
TRIM Function .......................................................................................................................................................... 45
UCASE Function ........................................................................................................................................................ 45
User Defined Function References ........................................................................................................................... 45
VAL Function ............................................................................................................................................................ 45
WEEKDAY Function .................................................................................................................................................. 45
YEAR Function .......................................................................................................................................................... 45
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 6
SQL SERVER OBJECTS ........................................................................................................................................................ 46
Table Creation .......................................................................................................................................................... 46
Append Stored Procs ................................................................................................................................................ 46
Update Stored Procs ................................................................................................................................................. 46
Delete Stored Procs .................................................................................................................................................. 46
MakeTable Procs ...................................................................................................................................................... 46
CrossTab Procs ......................................................................................................................................................... 47
Select and Union Views ............................................................................................................................................ 47
CrossTab Views ........................................................................................................................................................ 47
User Defined Function Templates ............................................................................................................................ 47
UPDATE Triggers for Tables ..................................................................................................................................... 47
DELETE Triggers for Tables ....................................................................................................................................... 47
INSERT Triggers for Tables ....................................................................................................................................... 47
INSTEAD OF INSERT Triggers for Tables ................................................................................................................... 48
INSTEAD OF DELETE Triggers for Views ................................................................................................................... 48
INSTEAD OF UPDATE Triggers for Views .................................................................................................................. 48
INSTEAD OF INSERT Triggers for Views .................................................................................................................... 48
Foreign Key Constraints ........................................................................................................................................... 48
Check Constraints ..................................................................................................................................................... 48
Default Value Constraints ........................................................................................................................................ 48
Virtual Table RowCount Reconciliation .................................................................................................................... 48
ODBC CONNECTION OBJECTS ............................................................................................................................................. 49
ODBC Links to Tables ................................................................................................................................................ 49
ODBC Links to Views ................................................................................................................................................. 49
ODBC Indexes ........................................................................................................................................................... 49
Pass-Through Queries .............................................................................................................................................. 49
APPLICATION FRAMEWORK ................................................................................................................................................. 50
Aggregate Functions in Form Controls ..................................................................................................................... 50
Form/Report ControlSource Syntax.......................................................................................................................... 50
ControlSource Syntax of Report GroupLevels ........................................................................................................... 51
Form/Report ORDER BY Properties .......................................................................................................................... 51
Form/Report RecordSource Properties .................................................................................................................... 51
Form/Report RowSource Properties ......................................................................................................................... 51
Form/Report ControlSource Properties with Input Parameters ............................................................................... 52
Query Names Longer than 60 Characters ................................................................................................................ 52
Query Metadata ....................................................................................................................................................... 52
Table Metadata........................................................................................................................................................ 52
Updatable Forms with Read Only Recordsets .......................................................................................................... 52
Parent Table Key Changes from Forms .................................................................................................................... 53
Child Table Key Changes from Forms ....................................................................................................................... 53
Form Controls bound to Tables with Default Values ................................................................................................ 53
2SQL Toolkit Objects ................................................................................................................................................ 53
OPTIMIZATION OF DATA OBJECTS ......................................................................................................................................... 54
Domain Functions .................................................................................................................................................... 54
RunSQL Usage .......................................................................................................................................................... 54
Code Alerts ............................................................................................................................................................... 56
DAO RecordSet Variable Declarations ..................................................................................................................... 56
DAO RecordSet Instantiations .................................................................................................................................. 56
DAO RecordSet Properties ........................................................................................................................................ 57
DAO Executes ........................................................................................................................................................... 58
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 7
DAO DBEngine Commands ....................................................................................................................................... 58
ADO RecordSet Instantiations .................................................................................................................................. 58
Obsolete DAO Usage ................................................................................................................................................ 58
CurrentProject Connections ..................................................................................................................................... 58
VBA FRAMEWORK ............................................................................................................................................................ 59
CloseQuery Calls ....................................................................................................................................................... 59
OpenQuery Calls ....................................................................................................................................................... 59
OpenForm Calls ........................................................................................................................................................ 59
OpenReport Calls ...................................................................................................................................................... 59
OpenQuery SetHostValue Calls ................................................................................................................................ 60
OpenForm SetHostValue Calls .................................................................................................................................. 60
OpenReport SetHostValue Calls ............................................................................................................................... 60
Queries Longer than 60 Characters in VBA Code ..................................................................................................... 60
DEPLOY TO PRODUCTION ENVIRONMENT ............................................................................................................................... 61
Recreate Table Objects and Data ............................................................................................................................. 61
New Table Objects ................................................................................................................................................... 61
HostName Tables ..................................................................................................................................................... 61
User Defined Functions ............................................................................................................................................ 61
Views ........................................................................................................................................................................ 61
View Triggers ........................................................................................................................................................... 61
Stored Procedures .................................................................................................................................................... 62
Pseudo Index Table Data .......................................................................................................................................... 62
2SQL VERSION HISTORY .............................................................................................................................................63
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 8
Introduction
This technical guide describes each of the “conversion issues” that 2SQL identifies and
automatically addresses. Not every issue appears in every database, but if it does, it
must be dealt with for the new Microsoft Access/SQL Server application to behave and
function as expected. Some of the conversions are very basic and do not require a
detailed explanation. Others are quite complex. Examples are given to describe how
and why 2SQL deals with them.
There are several documents published by Microsoft and other companies which
provide a basic technical understanding of converting and migrating Microsoft Access to
SQL Server. However, our research and testing has uncovered many additional
conversion issues which were not documented anywhere. All of these issues and
methods to remedy them have programmed into 2SQL or documented in our process.
It is assumed that the reader of this document possesses a comprehensive knowledge of
Microsoft Access and SQL Server programming. It should also be noted that whilst there
is considerable detail in this document, readers are cautioned against using this
document as an exclusive source to attempt to convert an application manually.
Theexamples provided do not reflect the entirety of the methodology by which 2SQL
programmatically analyses existing syntax and applies its modifications.
This Technical Reference Guide should also be read in conjunction with the 2SQL
Functionality Overview document, the 2SQL User Guide, the 2SQL Conversion Services
Guide and all 2SQL Toolkit Documents. Together with 2SQLand support from ConvertU2,
these technical documents will take the reader through an entire conversion project
from start to finish.
____________________________
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 9
Conversion Categories by Component
This next section lists and describes each of the Conversion Categories in each
Conversion Component that 2SQL automatically identifies and remediates.The “2SQL
Conversion Issue, Complexity and Manual Estimation Report” screen below is a
summary of all Conversion Categories by Conversion Component, from a scan of a highly
complex sample database by 2SQL in Detective mode. See the 2SQL Functionality
Overview document for more information about the results of this scan and the value
proposition that 2SQL offers.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 10
The following sections include 2SQL screen shots showing details of Issue Count, Rating
and Conversion Elements by Conversion Category for each of the Conversion
Components.
Although these sectionsalso explain the Conversion Issue and a corresponding solution,
it does not explain how to find the issue in the first place or the potential cascading
effect that the remedy has on the rest of the application. 2SQL's ability to scan, analyse,
and remedy every single property of the objects in the Access database automatically
addresses these concerns as well.
It should also be noted that the Conversion Issues in each Category can exist in far more
permutations than the examples provided. 2SQL is programmed to anticipate and
remedy all possible permutations.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 11
Table Schema (Field Types)
Text Field Types
2SQL will convert table fields of type Text to the SQL Server Varchar type with its
corresponding field length.
Memo Field Types
2SQL will convert table fields of type Memo to the SQL Server Text field type. Memo
field types can circumstantially be converted to varchar(max), but the SQL Server Native
Client ODBC drivers do not fully support varchar(max) when the length of the field is
greater than 255 characters. The Native Client driver will return a field of type memo
back to the Access front end if the SQL Server field type is Text. This is the main reason
why 2SQL converts Memo to Text.
Date Field Types
2SQL will convert table fields of type Date to the SQL Server DateTime type. The minute
and second components of each date value are also preserved.
Date Based Unique Indexes
2SQL will convert table fields of type Date to the SQL Server Date type instead of
DateTime whenever it belongs to a Unique index. This ensures that the index occurs at
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 12
the day level, like it does in Microsoft Access. However, this conversion category is only
used with SQL Server 2008 solutions.
Boolean Field Types
2SQL will convert table fields of type Boolean (Yes/No) to the SQL Server Bit type.
AutoNumber Field Types
2SQL will convert table fields of type AutoNumber to the SQL Server Integer type with
the Identity property set to true and seed value 1 increment value 1.
Integer Field Types
2SQL will convert table fields of type Integer to the SQL Server SmallInteger type.
Long Field Types
2SQL will convert table fields of type Long Integer to the SQL Server Integer type.
Decimal Field Types
2SQL will convert table fields of type Decimal to the SQL Server Decimal type with
corresponding precision and scale.
Long Binary Field Types
2SQL will convert table fields of type Long Binary to the SQL Server Image type.
GUID Field Types
2SQL will convert table fields of type GUID to the SQL Server UniqueIdentifier type.
Currency Field Types
2SQL will convert table fields of type Currency to the SQL Server Money type.
Single Field Types
2SQL will convert table fields of type Single to the SQL Server Real type.
Double Field Types
2SQL will convert table fields of type Double to the SQL Server Float type.
Byte Field Types
2SQL will convert table fields of type Byte to the SQL Server SmallInteger type.
Attachment Field Types
2SQL will convert table fields of type Attachment to the SQL Server Varbinary(max) type.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 13
Table Schema (Constraints)
Table Relationship Field Size Conflicts
If the source column of a table relationship is a field of type text and differs in size to the
foreign column, 2SQL will increase the size of the smaller field to the larger.
Table Relationship Field Type Conflicts
If the source column of a table relationship is of a different field type to the foreign
column, 2SQL will calculate which field type takes precedence, and make them both the
same field type.
Column Validation Rule Syntax
Table Column Validation Rules will have their column name included in the formula if
the AND/OR clauses are used. For example:
>= 100 AND <= 200
Becomes
[columnname] >= 100 AND [columnname] <= 200
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 14
Column Default Value Syntax
2SQL will convert default value specific syntax to its SQL Server Equivalent. For example,
a default value of GENGUID() will be converted to NEWSEQUENTIALID(). Otherwise,
2SQL will generate a dummy SQL Statement SELECT clause using the default value as the
first field, and pass it through all the SQL Statement conversion rules, and create a SQL
Server Default Constraint. See the component called SQL Statements in this document
for more information.
Table Relationship Deletions
2SQL will delete all Table Relationships in the Access database. These are converted to
SQL Server Foreign Key Constraints later in the conversion process. See the component
called SQL Server Objects in this document for more information.
Column Format Properties
2SQL will copy the Format property of Table Columns to their corresponding linked
Table Object equivalent.
InputMask Properties
2SQL will copy the InputMask property of Table Columns to their corresponding linked
Table Object equivalent.
TimeStamp Columns
2SQL will add a timestamp column called RowVersion to each table migrated to SQL
Server. This is done to assist the SQL Server Native Client ODBC connection record
locking methods.
Column DisplayControl Properties
2SQL will copy the DisplayControl properties of Table Columns to their corresponding
linked Table Object equivalent. The following properties are copied:-
DisplayControl ListWidth Rowsource RowSourceType
BoundColum ColumnCount ColumnWidth ColumnHidden
ListRows LimitToList
Nullable Boolean Fields
If the Column of a Table is originally of type Boolean that allows nulls, 2SQL will enforce
the column NOT to allow nulls. This is because Microsoft Access treats Null Boolean
fields as False. See the category directly below for more information.
Nullable Boolean Fields without Default Value
Further to the category directly above, if the Column of a Table is originally of type
Boolean that allows nulls and there is no default value, 2SQL will enforce a default of 0.
Memo Fields with Validation Rules
The equivalent to a field of type Memo in SQL Server is Text, which does not allow Check
Constraints, so 2SQL will create Triggers on the table that serve the same purpose as the
Access Validation Rule.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 15
Disallow Zero Length String Constraints
When the AllowZeroLength property of a field of type String/Text is true, and there is no
validation rule, 2SQL will create a CHECK constraint in SQL Server that checks the length
of the field.
Disallow Zero Length Memo Constraints
When the AllowZeroLength property of a field of type Memo is true, and there is no
validation rule, 2SQL will create Triggers on the table that serve the same purpose.
Triggers are required because the equivalent SQL Server column of type Text will not
allow a CHECK constraint.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 16
Table Schema (Indexes)
Primary Key Indexes
2SQL converts Microsoft Access Primary Key Indexes to SQL Server Primary Key indexes.
Unique Indexes
2SQL converts Microsoft Access Unique Indexes to SQL Server Unique indexes. Columns
belonging to Unique Indexes that are not composite ones will be set not to allow null
values irrespective of the value of the Required Property of the table column, so long as
the data in the table does not conflict with this condition. If null values are detected in
the data columns of such unique indexes, 2SQL will not create the corresponding unique
index in SQL Server, and log this issue as an alert for review post conversion.
Non Unique Indexes
2SQL converts Microsoft Access Duplicates Allowed Indexes to SQL Server Non Unique
Indexes.
Tables with Unique Index but no Primary Key
Tables with unique indexes but none of them being a primary key are usually an
oversight of schema design and can cause confusion. There is no reason why one of the
unique indexes cannot be a primary key. Both Access and SQL Server look for the
primary key of a table over any unique index to identify and process unique rows of a
table. When 2SQL encounters such tables it will make the first unique index a primary
key.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 17
Tables with no Unique Index and no AutoNumber
Tables without a Unique Index become read only tables when they are linked to SQL
Server from the Microsoft Access front end. When 2SQL encounters tables without a
primary key, it will add an autonumber column with a naming convention of
TableName_ID for the column name. 2SQL will then add a primary key to this column as
per the conversion category directly above.
AutoNumber Tables with no Unique Index
Tables without a Unique Index become read only tables when they are linked to SQL
Server from the Microsoft Access front end. When 2SQL encounters tables of this nature
but also with an autonumber column, it will add a primary key to the
autonumber/identity column, thereby making the table updateable from the front end.
Clustered Indexes
2SQL will identify the Microsoft Access Unique index that can become clustered and set
the clustered property of the corresponding SQL Server Index to true.
Indexed Memo Fields
Fields of type Memo get converted to the SQL Server Text field type by 2SQL. However,
Text field types in SQL Server do not support indexing. 2SQL will recognize this and
bypass creating the index in SQL Server.
Composite Primary Keys with Autonumbers
When 2SQL detects a table with an autonumber column as part of a composite primary
key, it will remove all other columns and make the autonumber the singular primary
key. Although this is a design issue more than a conversion issue, doing so avoids
complications when the need for troubleshooting occurs.
Nullable Unique Indexes
Microsoft Acccess allows Unique Indexes on nullable fields where the data can have
multiple null values. SQL Server does not. 2SQL will create INSTEAD OF Triggers that
serve the same purpose as these Nullable Unique Indexes.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 18
Table Data
Invalid Date Values
Date fields in Access tables with less than January 1 1753 or greater than December 31
9999 will be modified to a value of January 1 1753 by 2SQL. These date values are the
lowest and highest respectively for SQL Server columns of type datetime.
Duplicate AutoNumbers
Tables with AutoNumbers that do not have a unique index can potentially have
duplicate autonumber rows. Such tables are corrupt in Microsoft Access and are caused
by known bugs in Access itself. 2SQL will detect and remove duplicate autonumber rows
so as to avoid violation errors that would otherwise prevent 2SQL from migrating the
data of such tables to SQL Server.
Null AutoNumbers
Tables with AutoNumbers that do not have a unique index can also potentially have null
autonumber rows. Such tables are corrupt in Microsoft Access and are caused by known
bugs in Access itself. 2SQL will detect and remove null autonumber rows so as to avoid
violation errors that would otherwise prevent 2SQL from migrating the data of such
tables to SQL Server.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 19
Unindexed Required Fields with Null Values
It is possible for Microsoft Access fields that do not allow nulls to actually have null
values. Such data is in conflict with the schema and will prevent the entire table from
being migrated to SQL Server. When this occurs on fields that do not belong to a unique
index and there is no validation rule, 2SQL will set fields of type string/memo to an
empty string, date fields Jan 1 1753, and numeric fields to zero. A warning message alert
will also be logged to trigger a review during the cleanup phase of the conversion
project.
Unique Indexed Required Fields with Null Values
Further to the category directly above, if the field belongs to a Unique Index 2SQL will
remove the culprit rows from the table because these rows are in conflict with the table
schema. A warning message alert will also be logged to trigger a review during the
cleanup phase of the conversion project.
Orphaned Table Relationship Records
It is possible for Microsoft Access to have orphaned records in Table Relationships. 2SQL
will remove such records because they are in conflict with the table schema. A warning
message alert will also be logged to trigger a review during the cleanup phase of the
conversion project.
Data Migration
Once the Table schema has been converted and migrated to SQL Server, 2SQL will
migrate all of the data in all Microsoft Access Tables to their corresponding SQL Server
Tables.
Table RowCount Reconciliation
2SQL will reconcile the row counts of the original Access Table and the corresponding
SQL Server table after migration. Row counts that match are treated as a successful
reconciliation. Rowcounts that do not match are treated as an error requiring manual
review.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 20
SQL Statements (A to E)
Aggregate SELECTs
JET allows a SELECT statement to be a parameter of an Aggregate Function. SQL Server
does not. 2SQL will restructure the syntax of the SELECT clause and the aggregate
function to a working equivalent. For example,
MIN(SELECT numfield FROM tablename)
Becomes
(SELECT MIN(numfield) FROM tableName)
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 21
Alias Name References
Column Alias Names that are referred to before or after they are defined in the SQL
Statement are replaced with the corresponding Alias Definition. For example:-
SELECT A*B AS C,C*D AS E
Becomes
SELECT A*B AS C, A*B*D AS E
Boolean Expressions
Boolean Values of Yes, True, On, and -1 are converted to a value of 1.Boolean Values of
No, False, and Off are converted to a value of 0.
Boolean Sorts
Sorting by a Boolean field in Microsoft Access in ascending order will display Boolean
values of True before False, but in SQL Server False values will display before True
values. 2SQL will automatically reverse the sort order for Boolean Sorts in the ORDER BY
clause.
Bracketed Joins
2SQL will remove the brackets of JOINS encapsulated with left and right round brackets
to ensure compilation in SQL Server.
Cartesian Joins
When 2SQL detects a Cartesian Join it will add the CROSS JOIN predicate because not all
Cartesian Joins will compile in SQL Server without this predicate.
Crosstab Syntax
2SQL Converts Access CrossTab Queries that have an IN Clause to SQL Server Views.
CrossTabs that do NOT have an IN Clause are converted to Stored Procedures. In both
cases, the entire SQL Statement is restructured to use the SQL Server PIVOT clause. For
example:
TRANSFORM Sum(table1.amount) AS SumOfAmount SELECTtable1.field1,table1.field2
FROM table1 GROUP BY table1.field1,table1.field2 PIVOT table1.field2 In ("A”,"B")
Becomes
SELECT * FROM (SELECT table1.field1,table1.field2,table1.amount FROM table1) p
PIVOT (Sum(p.amount) FOR p.field2 IN ([A],[B]) ) AS pvt
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 22
DATEADD String Comparisons
When 2SQL identifies string based Date expressions used in the DATEADD Function, it
will implement the 2SQL Toolkit Function FormatDateSQL to return the date in Short
Date Format in order to reflect Microsoft Access functionality when applying
computations to string based date expressions.
Date Based Comparisons
JET compares dates at the day level, and SQL Server compares dates at the millisecond
level. 2SQL converts date comparisons to use the DATEDIFF Function. For example:-
SELECT F1 FROM TableName WHERE DateField1 = DateField2
Becomes
SELECT F1 FROM TableName WHERE DATEDIFF(dd,DateField1,DateField2)=0
When date fields are part of a Non Deterministic BETWEEN clause, 2SQL will implement
its built in function called BETWEENDATES2SQL to simplify the syntax. See the category
called Non Deterministic BETWEEN clauses for more information.
Date based DISTINCTs
If 2SQL has already converted a SELECT DISTINCTROW to SELECT DISTINCT, it may refer
to fields that were originally of type Date. To enforce DISTINCT processing at the day
level instead of the millisecond level, 2SQL will use the CONVERT function with a style of
106 as follows:-
SELECT DISTINCT datefield FROM Table1
becomes
SELECT DISTINCT CONVERT(varchar(max),datefield,106) FROM Table1
Date Based GROUP BYs
Date Based fields that reside in the SELECT clause and are used in the GROUP BY clause
of a SQL Statement are grouped at the day level in Microsoft Access. In SQL Server, the
grouping occurs at the millisecond level. 2SQL will encapsulate such date based fields
with the CONVERT function using a style of 106. For example:-
SELECT T1.DateVal, SUM(T1.NumVal) FROM T1 GROUP BY T1.DateVal
Becomes
SELECT CONVERT(varchar(max), T1.DateVal), SUM(T1.NumVal) FROM T1 GROUP BY
CONVERT(varchar(max),T1.DateVal,106)
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 23
Date Based Joins
Joins referring to fields of type Date do a Join at the day level in Microsoft Access. In SQL
Server, this occurs at the millisecond level. 2SQL will implement the DATEDIFF function
at the day level for date based joins to enforce day based date joins. For example:
SELECT * FROM Table1INNER JOIN Table2 ON Table1.F1 = Table2.F1
Becomes
SELECT * FROM Table1 INNER JOIN Table2 ON DATEDIFF(dd,Table1.F1,Table2.F1)=0
Date Expressions
The Hash (#) symbol is replaced with a single quote for dates that are expressed as
literal strings.
Date Functions using Dynamic Interval Parameter
When 2SQL Detects Date functions with dynamic interval parameters it will implement
the corresponding built in 2SQL Toolkit Function that accepts this parameter dynamically
and applies the calculation. This is because SQL Server Date Intervals must be strongly
typed.
Date Functions using FirstDayOfWeek Parameter
When 2SQL Detects Date functions that use the FirstDayOfWeek Parameter it will
implement the corresponding built in 2SQL Toolkit Function that includes
FirstDayOfWeek calculations. For example the DATAPART function will be replaced with
DATEPART2SQL.
DELETE Statement Syntax
DELETE Statements that use the asterisk (*) symbol representing all columns of a Table
or Query will have this part removed. References to individual columns are also
removed.
DELETE Statements that refer to JOINS in the FROM Clause will be restructured to refer
specifically to the Table/View that will have rows deleted from it. For example:
DELETE * FROM T1 INNER JOIN T2 ON T1.F1 = T2.F1
Becomes
DELETE T1 FROM T1 INNER JOIN T2 ON T1.F1 = T2.F1
Deterministic BETWEEN Clause Comparisons
The compare parameters of a deterministic BETWEEN clause are swapped around if the
second compare parameter is less in value than the first compare parameter.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 24
DISTINCTs with Foreign ORDER BY Expressions
SELECT DISTINCT clauses that refer to columns in the ORDER BY clause that are not part
of the DISTINCT clause are converted to a Table Alias. For example:
SELECT DISTINCT F1,F2 FROM T1 ORDER BY F3
Becomes
SELECT DISTINCT DerivedTable.* FROM (SELECT TOP 9999999 F1,F2 FROM T1 ORDER BY
F3) DerivedTable
DISTINCTROW Selects
The DISTINCTROW predicate of a SELECT statement is removed if it is an updateable
one.
DISTINCTROW SELECTS that refer to JOINS, but also refer to one or more columns from
each of the JOIN objects in the SELECT clause, are converted to normal SELECT
statements.
DISTINCTROW SELECTS that do not refer to JOINS are converted to normal SELECT
statements (i.e., DISTINCTROW is completely removed).
Otherwise, DISTINCTROW is converted to DISTINCT.
Double Quotation Usage
All double quotes are converted to single quotes.
Duplicate Column Aliases
Microsoft Access deals with Duplicate Column References in several different ways
subject to the content of the SQL Statement, as follows:
1. Ignores the reference completely so that it does not display and cannot be referred to by other SQL Statements. 2SQL will remove the duplicate reference.
2. Creates an alias of value Expr101x on the fly, where x is a number from 0 to 9. 2SQL determines when this occurs and adds an alias of the same name to the duplicate column reference.
3. When a column of the same name belongs to two (or more) objects, and both instances are referred to in the SELECT clause, Microsoft Access JET will dynamically name them as table1.columnname and table2.columnname, without aliases. Although it is possible to create columns with full stops in SQL Server, they cannot be referred to from Microsoft Access by way of linked tables, so 2SQL will create an alias of TableName_ColumnName in such instances. 2SQL will also address the cascading effect this has on other SQL Statements that refer to them by way of nested queries.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 25
Duplicate ORDER and GROUP BY Expressions
2SQL will remove any duplicate reference in ORDER and GROUP BY clauses. Superfluous
in JET, it is not tolerated in SQL Server T-SQL. For example:
SELECT * FROM TableName ORDER BY F1,F2,F1
Becomes
SELECT * FROM TableName ORDER BY F1,F2
Dynamic Aliases
When the field of a SELECT clause is a computed expression without an Alias Name, JET
will create one dynamically at run time. 2SQL will detect these occurrences and add the
Alias to the computed expression permanently in the SQL Statement.
For example:-
SELECT NOW()
Becomes
SELECT GETDATE() as [Expr1001]
Encapsulated Table Column Expressions
References to [ObjectName.ColumnName] are converted to
[ObjectName].[ColumnName]
Exclamation Mark Usage
Expressions that use the exclamation mark to refer to the column of a query or table are
replaced with a full stop. For example:
TableName!ColumnName
Becomes
TableName.ColumnName
EXISTS Functions with Boolean Reference
References to EXISTS compared to True will have the comparison to True removed.
References to EXISTS compared to False will have the comparison to False removed and
replaced with NOT EXISTS.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 26
SQL Statements (F to N)
Floating Point Divisions
JET Returns a data type of Double when performing divisions in SQL Statements. With
SQL Server, it returns the data type of the dividend component of the divide. When the
data type of the dividend is NOT of type FLOAT, 2SQL will encapsulate the dividend with
CONVERT(float,..) .
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 27
Functions Requiring Data Type Conversions
SQL Server Functions such as SUM are strict in their usage of data types. For example:
SUM(nonnumericfield)
Becomes
SUM(CONVERT(integer,nonnumericfield))
2SQL applies various checks to various functions and implements the CONVERT function
where necessary.
Implicit SELECTs
The asterisk symbol can be used in SELECT clauses as a shortcut to display all columns
belonging to a table or query. However, the columns will need an explicit reference if
any kind of conversion on them is required due to other conversion categories. In such
instances, 2SQL will remove the asterisk and replace it with an explicit reference to all
columns of the SELECT object(s).
HAVING Clauses with no GROUP BY Clause
The criteria of the HAVING clause needs to be moved to the WHERE clause when there is
no GROUP BY clause and the HAVING clause does not relate to the aggregate function
used in the SELECT clause.
Implicit Sorts Using DISTINCT
Select Statements that use DISTINCT in Microsoft Access sort by the first SELECT column
if there is no ORDER BY clause. 2SQL will determine the first ordinal positioned column
of the SELECT clause and create an ORDER BY clause to sort on this column.
Implied Boolean Comparisons
WHERE and HAVING clauses that compare boolean expressions are converted to use
CASE. For example:
WHERE A = B = 1
Becomes
WHERE CASE WHEN A = B THEN 1 ELSE 0 END =1
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 28
Implied Boolean Expressions
SELECT columns that are implied Booleans are converted to use CASE. For example:
SELECT A = B as C
Becomes
SELECT CASE WHEN A = B THEN 1 ELSE 0 END AS C
Implied Form/Report Control Input Parameters
It is possible in Microsoft Access to refer to a Form or Report control without referring to
the Form or Report name. 2SQL will implement the 2SQL Hosts Utility on such
occurrences. See the category called Implied Input Parameters directly below for more
information.
Implied Input Parameters
Native to JET but foreign to SQL Server, expressions such as
forms!formname!controlname in SQL Statements require posting to SQL Server before
the SQL Statement can be executed. 2SQL replaces Form and Report Control input
parameter references with one of the 2SQL Host Functions. For example:
SELECT * FROM TableName WHERE F1 = forms!formname!controlname
Becomes
SELECT * FROM TableName WHERE F1 =
dbo.Host_VarcharValue(‘Forms_FormName_ControlName’,null)
See the 2SQL Toolkit Document section entitled How and When to Use the 2SQL Hosts
Utility for more information.
Linked SubForms
Forms linked to Subforms via the LinkChild and LinkMaster fields property of the parent
form can suffer significant performance problems once the Access database is upsized to
SQL Server. This is because Microsoft Access will download the entire table/query of the
subform recordsource before it filters out records based on the values of LinkChild. The
2SQL Toolkit has a utility that optimises sub forms. In order for this to work, the SQL
Statement of the subform recordsource must be aware of the current record value of
the LinkMaster property in the parent form. This conversion category covers the
modifications that 2SQL does to the SQL Statement of the recordsource sub form. The
Northwind_CU2 database has an example of this conversion category.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 29
MakeTable Statement Syntax
Computed Columns belonging to the SELECT clause of a MAKETABLE statement that do
not have an Alias will have an Alias created by 2SQL, where the name of the Alias is
“column_” concatenated to the ordinal position value of the computed column.
Memo based DISTINCTs
If 2SQL has already converted a SELECT DISTINCTROW to SELECT DISTINCT, it may refer
to fields that were originally of type Memo. The corresponding SQL Server Text field
type cannot be used with DISTINCT. 2SQL will use the CONVERT function as follows:-
SELECT DISTINCT memofield FROM Table1
becomes
SELECT DISTINCT CONVERT(varchar(max),memofield) FROM Table1
Memo Based GROUP BYs
Fields originally of type Memo that reside in the SELECT clause and are used in the
GROUP BY clause of a SQL Statement cannot be grouped because of one of the
restrictions of the SQL Server equivalent field of type Text. SQL will use the CONVERT
function to change these fields to varchar dynamically at run time. For example:-
SELECT T1.MemoVal, SUM(T1.NumVal) FROM T1 GROUP BY T1.MemoVal
Becomes
SELECT CONVERT(varchar(max), T1.MemoVal), SUM(T1.NumVal) FROM T1 GROUP BY
CONVERT(varchar(max),T1MemoVal)
Memo Based Function Parameters
JET accepts fields of type memo as a parameter for string based functions. However, SQL
Server string based functions will not accept fields of type Text as a parameter. 2SQL will
apply a dynamic conversion when Text fields are used in String based SQL Server
functions. For example,
LEFT(textfieldname,10)
Becomes
LEFT(CONVERT(varchar(max),textfieldname),10)
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 30
Memo Based Joins
Joins referring to fields originally of type Memo need a dynamic conversion to Varchar
because the SQL Server Text equivalent field type cannot be used with Joins. 2SQL will
implement the CONVERT function to enforce a functional join. For example:
SELECT * FROM Table1INNER JOIN Table2 ON Table1.F1 = Table2.F1
Becomes
SELECT * FROM Table1 INNER JOIN Table2 ON
CONVERT(Varchar(max),Table1.F1)=CONVERT(varchar(max),Table2.F1)
Memo Based ORDER BYs
As per the category directly above applied to the ORDER BY clause, because SQL Server
Text fields cannot be sorted. The SELECT clause is not modified.
Missing Keys in SELECT Clauses
JET does not require all the primary keys of the parent tables of updatable SQL
Statements to reside in the SELECT clause. For example, primary keys of type
AutoNumber are not required. Also, JET will assess the JOIN clauses to see if the column
that is joined to the parent table column is in the SELECT clause. If so, it will use this as
an alias to keep the SQL Statement updatable.
SQL Server however, demands that all keys of all Parent Tables reside in the SELECT
clause, to be updatable. In most instances, 2SQL is able to detect the updatable Parent
Tables of a SQL Statement, and once this has been determined, it will then add the
missing keys to the SELECT clause, allowing the SQL Statement to remain updatable.
This also allows 2SQL to create the corresponding ODBC Indexes, and Triggers if there
are JOINS in the SQL Statements. See the components called ODBC Connection Objects
and SQL Server Objects for more information. 2SQL will also log an alert if it is unable to
identify the Parent Tables of Updatable SQL Statements.
MOD Operators
MOD Operators are replaced with %.
Multiple Object Updates
JET is capable of updating more than one object in the SET clause of UPDATE
statements, but SQL Server is not. 2SQL will generate one UPDATE statement per object
updated, and use the same joins and criteria as the original, per UPDATE statement.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 31
Non Deterministic BETWEEN Clause Comparisons
Non-Deterministic BETWEEN clauses utilize CASE to ensure that the first compare
parameter is less in value than the second. For example:
BETWEEN A AND B
Becomes
BETWEEN CASE WHEN A < B THEN A ELSE B END AND CASE WHEN A < B THEN B ELSE A
END
Non Text Based Concatenations
Concatenation of values that are not of type string/varchar are converted to varchar
before concatenation occurs. For example:
SELECT Integerfield + ‘ ‘ + StringField
Becomes
SELECT Convert(varchar(max),IntegerField) + ‘ ‘ + StringField
When the expression being concatenated is a field of type date, 2SQL will add a style to
the CONVERT function to remove the time component of the expression.
Numeric Alias and Object Names
2SQL will encapsulate Table or Column Alias Names that are Numeric with [].
2SQL will encapsulate Table or Query Object Names that are Numeric with [].
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 32
SQL Statements (O to Z)
OLE/HyperLink based DISTINCTs
If 2SQL has already converted a SELECT DISTINCTROW to SELECT DISTINCT, it may refer
to fields that were originally of type OLE,HyperLink. These field types cannot be used
with DISTINCT. 2SQL converts such instances as follows:-
OLEField
Convert(varbinary(max),OLEField)HyperlinkField
Convert(varchar(max),HyperLinkField)
OWNERACCESS OPTION
2SQL will remove any OWNERACCESS OPTION clauses in the SQL Statements.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 33
Query Names Longer than 60 Characters in SQL
2SQL will replace references to Query Names longer than 60 characters to the new
Query Name in SQL Statements..
Reserved Key Word Usage
Tables, Queries, Columns and Aliases that are also SQL Server Reserved Key words
circumstantially require encapsulation with []. See the document called 2SQL Reserved
Key Word List for more information.
Rounded Divisions
When the \ Symbol is used to perform divides, 2SQL will round the dividend using
Convert(Integer,...).
SELECTS requiring WITH TIES
SELECT TOP nnn requires WITH TIES in SQL Server to return the same number of rows as
Microsoft Access.
SELECTs with ORDER BY
2SQL will add TOP 9999999 to any SELECT Statement with an ORDER BY clause that is
converted to a SQL Server View, if there is no TOP clause in the original statement.
Square Bracket SELECTs
SELECT Statements that start with [ and end with ] are replaced with round brackets. For
example:
SELECT * FROM [SELECT F1,F2 FROM T1]
Becomes
SELECT * FROM (SELECT F1,F2 FROM T1)
String Concatenation Symbols
The & symbol when used for concatenation of values is replaced with the plus (+)
symbol.
Superfluous DISTINCTs
DISTINCT SELECTS will have DISTINCT removed if all the primary keys of the base/parent
table are used in the SELECT or JOIN sections combined.
Superfluous ORDER BY and GROUP BY expressions
Expressions that are Literal Strings or Numbers as part of ORDER BY or GROUP BY
clauses are removed. This is something that is tolerated by JET but not SQL Server T-SQL,
and has no effect on the result of executing the SQL Statement.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 34
Superfluous Semi Colons
Sub SELECTS in the SQL Statement can end with a semi colon in Microsoft Access. This is
not tolerated in SQL Server so 2SQL removes the semi colon.
TABLE SELECT Clauses
References to the TABLE clause are converted to SELECT. For example:
TABLE TableName
Becomes
SELECT * FROM TableName
TimeStamp Column Exclusion
Using the asterisk (*) to display all columns of a table will now show the newly created
TimeStamp Column called RowVersion (see the category called TimeStamp Columns in
Table Data/Schema section for more information). Timestamp columns should not be
referred to in SQL Statements and will cause the usage of DISTINCT when LEFT OR RIGHT
JOINS are used, to malfunction. 2SQL will replace the asterisk with all the other columns
of the table in the sequence of their ordinal position in the table, thereby removing the
reference to the RowVersion TimeStamp column.
UNIONs with Object Name in ORDER BY Clause
If the ORDER BY clause of the last clause of a UNION statement refers to
ObjectName.ColumnName syntax then the UNION statement itself is converted to a
Table Alias and the ObjectName is removed from the ORDER BY Clause. For example:
SELECT F1,F2 FROM T1 UNION SELECT F1,F2 FROM T2 ORDER BY T2.F2
Becomes
SELECT TOP 9999999 * FROM (SELECT F1,F2 FROM T1 UNION SELECT F1,F2 FROM T2 )
ORDER BY F2
UNIONs with Superfluous ORDER BY Clause
The ORDER BY clauses of a UNIION statement are removed if they do NOT belong to the
LAST UNION clause. Such instances are superfluous in JET and not tolerated by SQL
Server T-SQL.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 35
UPDATE Statement Syntax
If the SET clause of an UPDATE clause occurs AFTER the FROM clause, it is moved to
occur directly BEFORE the FROM clause.
UPDATE Statements that refer to JOINS without a FROM clause are modified to refer to
the table/view being updated directly after the UPDATE clause, followed by a FROM
clause that refers to both the table/view being updated, and the corresponding JOINS.
The DISTINCTROW and DISTINCT clauses are removed from UPDATE clauses.
User Defined Input Parameters
Input Parameters of SQL Statements are replaced with one of the 2SQL HOSTS utility
functions. For example:
SELECT * FROM TableName WHERE F1 = [Enter Product Code]
Becomes
SELECT * FROM TableName WHERE F1 =
dbo.Host_VarcharValue(‘Enter_Product_Code’,’’)
See the 2SQL Toolkit Document section entitled How and When to Use the 2SQL Hosts
Utility for more information.
Wildcard References
The Ansi89 Wildcard Symbols Exclamation Mark, Asterisk, and Question Mark are
converted to Caret, Percentage sign, and Underscore respectively. References to LIKE
are replaced with an equal (=) symbol if there are no Wildcards referred to. References
to NOT LIKE are replaced with <> if there are no Wildcards referred to.
XOR Operator
2SQL will replace the XOR operator with the built in 2SQL Toolkit Function called
XOR2SQL.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 36
VBA Functions (A to D)
ASC Function
2SQL will replace the ASC Function with ASCII. Includes ASC% usage.
CCUR Function
2SQL will replace the CCUR Function with CONVERT(Money, - Includes CCUR% usage
CDATE Function
2SQL will replace the CDATE Function with CONVERT(smalldatetime.
CDBL Function
2SQL will replace the CDBL Function with CONVERT(float. – Includes CDBL% usage
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 37
CHOOSE Function
2SQL will replace the CHOOSE Function with CASE. For example,
CHOOSE(indexfield,field1,field2)
becomes
CASE WHEN indexfield = 1 THEN Field1 WHEN indexfield = 2 THEN field2 ELSE NULL END
CHR Function
2SQL will replace the CHR Function with CHAR. Includes CHR$ usage.
CINT Function
2SQL will replace the CINT Function with CONVERT(smallint, - Includes CINT% usage.
CLNG Function
2SQL will replace the CLNG Function with CONVERT(integer, - Includes CLNG% usage.
CSNG Function
2SQL will replace the CSNG Function with CONVERT(real,
CSTR Function
2SQL will replace the CSTR Function with CONVERT(varchar(max), - Includes CSTR$
usage.
CURRENTUSER Function
2SQL will replace the CURRENTUSER Function with the SQL Server Function called
HOST_NAME(). The CURRENTUSER Function in Microsoft Access is obsolete as of Access
2010 because it is part of the deprecated Workgroup Security Module in Microsoft
Access. The HOST_NAME() function in SQL Server is its closest equivalent but services
may be required post conversion to ensure desired outcome.
CVDATE Function
2SQL will replace the CVDATE Function with CONVERT(datetime, - Includes CVDATE%
usage.
DATE Function
2SQL will replace the DATE Function with GETDATE().
DATEADD Function
2SQL will replace the first parameter of the DATEADD Function with its SQL Server
Equivalent. For example, DATEADD(“dd” is replaced with DATEADD(d
DATEDIFF Function
2SQL will replace the first parameter of the DATEDIFF Function with its SQL Server
Equivalent. For example, DATEDIFF(“dd” is replaced with DATEDIFF(d
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 38
DATEPART Function
2SQL will replace the first parameter of the DATEPART Function with its SQL Server
Equivalent. For example, DATEPART(“dd” is replaced with DATEPART(d
DATESERIAL Function
2SQL will replace the DATESERIAL Function with its own 2SQL Toolkit Function
DATESERIAL2SQL. The 2SQL Toolkit is provided with every 2SQL Conversion project.
DATEVALUE Function
2SQL will replace the DATEVALUE Function with CONVERT(varchar(max), with a style
value of 110
DAVG Function
2SQL will replace the DAVG Function with an equivalent domain SELECT clause. For
example,
DAVG(domain,column,criteria)
Becomes
(SELECT AVG(column) FROM domain WHERE criteria)
DAY Function
2SQL will replace the DAY Function with DATEPART(d – Includes DAY% usage.
DCOUNT Function
2SQL will replace the DCOUNT Function with an equivalent domain SELECT clause. For
example,
DCOUNT(domain,column,criteria)
Becomes
(SELECT COUNT(column) FROM domain WHERE criteria)
DLOOKUP Function
2SQL will replace the DLOOKUP Function with an equivalent domain SELECT clause. For
example,
DLOOKUP(domain,column,criteria)
Becomes
(SELECT TOP 1 column FROM domain WHERE criteria)
DMAX Function
2SQL will replace the DMAX Function with an equivalent domain SELECT clause. For
example,
DMAX(domain,column,criteria)
Becomes
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 39
(SELECT MAX(column) FROM domain WHERE criteria)
DMIN Function
2SQL will replace the DMIN Function with an equivalent domain SELECT clause. For
example,
DMIN(domain,column,criteria)
Becomes
(SELECT MIN(column) FROM domain WHERE criteria)
DSUM Function
2SQL will replace the DSUM Function with an equivalent domain SELECT clause. For
example,
DSUM(domain,column,criteria)
Becomes
(SELECT SUM(column) FROM domain WHERE criteria)
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 40
VBA Functions (E to M)
FIRST Function
2SQL will replace the FIRST Function with a SELECT TOP 1 ...FROM Criteria ORDER BY
expression based on the characteristics of the column and table that the function is
being used for.
FIX Function
2SQL will replace the FIX Function with ROUND(nnn,0,1).
FORMAT Function
2SQL will replace the FORMAT Function with an equivalent CONVERT function or other
SQL Server Functions depending on the Format parameter. For example
Format(xxx,”dd/mm/yyyy”)
Becomes
CONVERT(VARCHAR(max), xxx, 103)
Includes FORMAT$ usage.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 41
FORMATCURRENCY Function
2SQL will replace the FORMATCURRENCY Function with its own 2SQL Toolkit Function
FORMATCURRENCY2SQL. The 2SQL Toolkit is provided with every 2SQL Conversion
project.
FORMATDATETIME Function
The FORMATDATETIME function in Microsoft Access is an alternative to the FORMAT
function in Microsoft Access. 2SQL will calculate the equivalent FORMAT expression and
replace the FORMATDATETIME function with its FORMAT function equivalent and apply
the same rules as when converting the FORMAT function. See the FORMAT Function
category in this document for more information.
FORMATNUMBER Function
2SQL will replace the FORMATNUMBER Function with its own 2SQL Toolkit Function
FORMATNUMBER2SQL. The 2SQL Toolkit is provided with every 2SQL Conversion
project.
FV Function
2SQL will replace the FV Function with its own 2SQL Toolkit Function FV2SQL. The 2SQL
Toolkit is provided with every 2SQL Conversion project.
HOUR Function
2SQL will replace the HOUR Function with DATEPART(hh – Includes HOUR% usage.
IIF Function
2SQL will replace the IIF Function with CASE. For example,
IIF(a=b,c,d)
Becomes
CASE WHEN a=b THEN c ELSE d END
INSTR Function
2SQL will replace the INSTR Function with CHARINDEX with parameters reordered.
INSTRREV Function
2SQL will replace the INSTR Function with its own 2SQL Toolkit Function INSTRREV2SQL.
The 2SQL Toolkit is provided with every 2SQL Conversion project.
INT Function
2SQL will replace the INT Function with CONVERT(integer,
IPMT Function
2SQL will replace the IPMT Function with the 2SQL Toolkit Function IPMT2SQL. The 2SQL
Toolkit is provided with every 2SQL Conversion project.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 42
ISNULL Function
2SQL will replace the ISNULL Function with the following depending on how it is used.
For example,
ISNULL(a)
Becomes
CASE WHEN a IS NULL THEN ELSE 0 END
Or
a IS NULL
Or
a IS NOT NULL
LAST Function
2SQL will replace the LAST Function with a SELECT TOP 1 ...FROM Criteria ORDER
BY..DESC expression based on the characteristics of the column and table that the
function is being used for.
LCASE Function
2SQL will replace the LCASE Function with LOWER. Includes LCASE$ usage.
LEFT Function
2SQL will replace the LEFT Function with LEFT when it is expressed as LEFT$.
LEN Function
2SQL will replace the LEN Function with DATALENGTH. Includes LEN% usage.
LTRIM Function
2SQL will replace the LTRIM Function with LTRIM when it is expressed as LTRIM$.
MID Function
2SQL will replace the MID Function with SUBSTRING and resequence the parameters.
Includes MID$ and MID% usage.
MINUTE Function
2SQL will replace the MINUTE Function with DATEPART(mi, - Includes MINUTE% usage.
MONTH Function
2SQL will replace the MONTH Function with DATEPART(mm, - Includes MONTH% usage.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 43
VBA Functions (N to Z)
NOW Function
2SQL will replace the NOW Function with GETDATE()
NZ Function
2SQL will replace the NZ Function with ISNULL and an extra parameter if required. For
example,
NZ(stringvalue)
Becomes
ISNULL(stringvalue,’’)
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 44
PARTITION Function
2SQL will replace the PARTITION Function with its own 2SQL Toolkit Function
GETPARTITIONRANGES2SQL. The 2SQL Toolkit is provided with every 2SQL Conversion
project.
PMT Function
2SQL will replace the PMT Function with its own 2SQL Toolkit Function PMT2SQL. The
2SQL Toolkit is provided with every 2SQL Conversion project.
PPMT Function
2SQL will replace the PPMT Function with its own 2SQL Toolkit Function PPMT2SQL. The
2SQL Toolkit is provided with every 2SQL Conversion project.
PV Function
2SQL will replace the PV Function with its own 2SQL Toolkit Function PV2SQL. The 2SQL
Toolkit is provided with every 2SQL Conversion project.
RIGHT Function
2SQL will replace the RIGHT Function with RIGHT when it is expressed as RIGHT$.
ROUND Function
2SQL will add a second parameter with a value of zero (0) to the ROUND function if
there is only one parameter referred to in this function.
RND Function
2SQL will replace the RND Function with the SQL Server RAND function.
RTRIM Function
2SQL will replace the RTRIM Function with RTRIM when it is expressed as RTRIM$.
SPACE Function
2SQL will replace the SPACE Function with SPACE when it is expressed as SPACE$
STR Function
2SQL will replace the STR Function with STR when it is expressed as STR$
STRCONV Function
2SQL will replace the STRCONV Function with the 2SQL Toolkit Function STRCONV2SQL.
The 2SQL Toolkit is provided with every 2SQL Conversion Project.
STRING Function
2SQL will replace the STRING Function with REPLICATE
STRREVERSE Function
2SQL will replace the STRREVERSE Function with REVERSE.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 45
TIME Function
2SQL will replace the TIME Function with GETDATE() when used for Default Value
Constraints.
TRIM Function
2SQL will replace the TRIM Function with LTRIM(RTRIM – Includes TRIM$ usage.
UCASE Function
2SQL will replace the UCASE Function with UPPER. Includes UCASE$ usage.
User Defined Function References
References to Custom VBA Functions are converted to refer to their SQL Server User
Defined Function Template Equivalent expression. For example:-
SELECT CustomFunction(xxx)
Becomes
SELECT dbo.CustomFunction(xxx)
See the category called User Defined Function Templates for more information.
VAL Function
2SQL will replace the VAL Function with its own 2SQL Toolkit Function VAL2SQL. The
2SQL Toolkit is provided with every 2SQL Conversion project.
WEEKDAY Function
2SQL will replace the WEEKDAY Function with DATEPART(dw, - Includes WEEKDAY%
usage.
YEAR Function
2SQL will replace the YEAR Function with DATEPART(yy – Includes YEAR% usage.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 46
SQL Server Objects
Table Creation
For every Table in the original Microsoft Access Database, 2SQL will create the
corresponding SQL Server Table.
Append Stored Procs
2SQL Converts Access Append Queries to SQL Server Stored Procedures.
Update Stored Procs
2SQL Converts Access Update Queries to SQL Server Stored Procedures.
Delete Stored Procs
2SQL Converts Access Delete Queries to SQL Server Stored Procedures.
MakeTable Procs
2SQL Converts Access MakeTable Queries to SQL Server Stored Procedures.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 47
CrossTab Procs
2SQL Converts Access CrossTab Queries that do not have an IN Clause to SQL Server
Stored Procedures.
Select and Union Views
2SQL Converts Access Select and Union Queries to SQL Server Views.
CrossTab Views
2SQL Converts Access CrossTab Queries that have an IN Clause to SQL Server Views.
User Defined Function Templates
For each Custom VBA Function used in the SQL Statements, a SQL Server User Defined
Function Template is created by 2SQL for the Conversion programmer to continue on
converting the VBA coding to T-SQL. This encompasses the function parameters and
their data types, as well as returning the corresponding SQL Server data type. For
example, a Custom VBA Function that returns a String, will be converted to return
Varchar(max) in SQL Server. The original VBA code of the Custom VBA Function is also
migrated to SQL Server, but in a commented state so as to assist in the manual
conversion of this code to T-SQL Syntax.
UPDATE Triggers for Tables
When the creation of Foreign Key Constraints by 2SQL fails with an error message
advising of cycle or multiple cascade paths, or the source table needs an INSTEAD OF
UPDATE Trigger, 2SQL create an UPDATE trigger on the source table. These Update
triggers serve to provide the same functionality as the original table relationship when
updating records of the source table.
DELETE Triggers for Tables
When the creation of Foreign Key Constraints by 2SQL fails with an error message
advising of cycle or multiple cascade paths, or the source table needs an INSTEAD OF
DELETE Trigger, 2SQL will create a DELETE trigger on the source table. These Delete
triggers serve to provide the same functionality as the original table relationship when
deleting records from the source table.
INSERT Triggers for Tables
When the creation of Foreign Key Constraints by 2SQL fails with an error message
advising of cycle or multiple cascade paths, or the foreign table needs an INSTEAD OF
INSERT Trigger, 2SQL create an INSERT trigger on the foreign table. These Insert triggers
serve to provide the same functionality as the original table relationship when inserting
records into the foreign table.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 48
INSTEAD OF INSERT Triggers for Tables
Insertion of rows to a table with fields of type Boolean that originally allowed null values
require an INSTEAD OF INSERT trigger. This is because Access dynamically converts null
value Boolean fields to False before it writes to the table. However, this functionality is
lost when the table is linked to SQL Server. 2SQL will create an INSTEAD OF INSERT
trigger on all tables that have this criteria, and implement the ISNULL function to write a
value of 0 to the corresponding fields of type Bit in SQL Server. See the category called
Nullable Boolean Fields in the Table Schema/Data section for more information.
INSTEAD OF DELETE Triggers for Views
SQL Statements with JOINS that are converted to Updateable Views cannot have rows
deleted without an INSTEAD OF DELETE Trigger in SQL Server. 2SQL will calculate the
primary table and unique columns of each View, and create the trigger.
INSTEAD OF UPDATE Triggers for Views
SQL Statements with JOINS that are converted to Updateable Views cannot have rows
updated without an INSTEAD OF UPDATE Trigger in SQL Server. 2SQL will calculate
which tables can be updated and create the trigger.
INSTEAD OF INSERT Triggers for Views
SQL Statements with JOINS that are converted to Updateable Views cannot have rows
inserted without an INSTEAD OF INSERT Trigger in SQL Server. 2SQL will calculate the
primary table and unique columns of each View, and create the trigger. Other tables in
the view that are updatable will have their own UPDATE commands as part of the
trigger.
Foreign Key Constraints
2SQL will create a SQL Server Foreign Key Constraint for each Table Relationship in
Microsoft Access Rule. Columns belonging to Table Relationships will be set not to allow
null values irrespective of the value of the Required Property of the table column, so
long as the data in the table does not conflict with this condition.
Check Constraints
2SQL will create a SQL Server CHECK Constraint for each Column Validation Rule.
Default Value Constraints
2SQL will create a SQL Server Default Constraint for each Column Default Value.
Virtual Table RowCount Reconciliation
For every SQL Statement in the Access Queries, RecordSource of Forms and Reports, and
RowSource property of Forms and Reports, 2SQL will execute the Statement in Access
and Log the number of rows it returns.
When 2SQL creates the corresponding SQL Server View or Stored Procedure, it executes
once more and compares the row count. If the original row count is greater than zero,
and the SQL Server Row Count matches, this is logged as a successful virtual rowcount
reconciliation. If there is a row count conflict, an error is logged for review post
conversion.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 49
ODBC Connection Objects
ODBC Links to Tables
2SQL will delete the original Table object in the Access Database and replace it with an
ODBC Linked object connected to the equivalent SQL Server Table.
ODBC Links to Views
For SQL Statements that have been converted to SQL Server Views, 2SQL will delete the
original object in the Access Database and replace it with an ODBC Linked object
connected to the equivalent SQL Server View.
ODBC Indexes
SQL Statements that are converted to Updateable Views are not updateable from the
Microsoft Access Front End without a dummy “pseudo index” applied to the
corresponding linked object. 2SQL will calculate the primary table and unique columns
of each View, and create the pseudo index using the DAO Create Index command. This
is a particularly complex operation to perform when the SQL Server View refers to
multiple tables via JOINS.
Pass-Through Queries
For SQL Statements that have been converted to SQL Server Stored Procedures, 2SQL
will delete the original object in the Access Database and replace it with an ODBC Pass-
Through linked object connected to the equivalent SQL Server Stored Procedure.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 50
Application Framework
Aggregate Functions in Form Controls
2SQL will replaces references to the SUM Function in Form controls with the built in
2SQL Toolkit Function DSUMDIRECT. Otherwise SUM functions in Form Controls can
severely compromise performance due to Microsoft Access downloading the entire
recordsource before applying the computation of this function.
Form/Report ControlSource Syntax
The ControlSource property of Form and Report Controls may be bound to a column of
the recordsource that originally contained a full stop due to the way JET handles
duplicate column names. 2SQL will replace the ControlSource value with its converted
SQL Server equivalent name. For example,
QueryName.FieldName
Becomes
QueryName_FieldName
See the conversion category called Duplicate Column Aliases in the SQL Statements
component for more information.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 51
ControlSource Syntax of Report GroupLevels
Same as the category directly above but applied to the ControlSource property of the
GroupLevel objects in Reports.
Form/Report ORDER BY Properties
The OrderBy property of a Form will enforce client side processing when these objects
load, if the OrderByOnLoad property is set to true. The syntax of the OrderBy property
can also be incorrect because the RecordSource property may refer to a newly created
SQL Server View as a result of the 2SQL Conversion process. 2SQL will automatically
transfer the value of the OrderBy property to the View that the RecordSource property
refers to. If this view was originally an Access query, 2SQL will create a new View with an
ORDER BY clause, derived from the original Access Query. Otherwise it will remove the
original ORDER BY clause of the View that 2SQL created, and replace it with the OrderBy
property of the form. This ensures server side processing when Forms are loaded.
This category also applies to Reports.
Form/Report RecordSource Properties
2SQL will convert SQL Statements that reside in the RecordSource property of Forms to
SQL Server Views or Stored Procedures. 2SQL will then set the RecordSource property to
the name of the new SQL Server object. Views created from the RecordSource property
have a naming convention of ObjectName_RS
This category also applies to Reports.
Form/Report RowSource Properties
2SQL will convert SQL Statements that reside in the RowSource property of Form
controls to SQL Server Views or Stored Procedures. 2SQL will then set the RowSource
property to the name of the new SQL Server object. Views created from the RowSource
property have a naming convention of ObjectName_ControlName_Rows.
This category also applies to Reports.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 52
Form/Report ControlSource Properties with Input Parameters
The ControlSource property of Form controls can refer to input parameters of the SQL
Statement of the RecordSource. User defined input parameters no longer exist in the
front end due to the SQL Statement now residing in SQL Server as a View or Stored
Procedure, and 2SQL has already replicated this functionality by implementing the 2SQL
Hosts Utility. See the category called User Defined Input Parameters in the SQL
Statements component for more information. 2SQL will replace any reference to a user
defined input parameter with its corresponding VBA Function in the 2SQL Module. See
the section entitled All about the other 2SQL Functions in the 2SQL Toolkit Document for
more information. For example:-
[Enter Beginning Date]
Becomes
DateTimeValue(“Enter Beginning Date”)
This category also applies to Reports.
Query Names Longer than 60 Characters
The SQL Server Native Client Driver does not allow ODBC connections to have object
names greater than 60 characters. 2SQL will truncate Query Object Names to the first
available name less than or equal to 60 characters. See the related category in the SQL
Statements section of this document.
Query Metadata
2SQL will migrate Microsoft Access Query Description values to SQL Server as a SQL
Server property in the corresponding View or Stored Procedure.
Table Metadata
2SQL will migrate Microsoft Access Table and Field Description values to SQL Server as a
SQL Server property in the corresponding Table or Field.
Updatable Forms with Read Only Recordsets
Forms with read only recordsets, but with the AllowAdditions, or AllowDeletions
properties set to true will be changed to false by 2SQL. This is done to assist in the
reconciliation process post conversion, during the cleanup phase. See the 2SQL
Preparation and Cleanup guide for more information. The AllowEdits property is left
alone due to the possibility of having controls that are not bound to the recordset.
If 2SQL cannot determine with certainty on whether or not the recordset is read only, it
will log an error of type Alert, for manual review.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 53
Parent Table Key Changes from Forms
Forms of view type datasheet with form controls that have controlsources bound to the
primary keys of any of the parent tables of an updateable recordset, require a form
refresh command in the afterupdate event when an existing record is being modified.
Changing the value of a primary key is the same as deleting the existing record and
inserting a new one. A #deleted# error message will display unless the form is refreshed.
If there is no afterupdate event, 2SQL will create the VBA Event Procedure. If the
afterupdate event refers to another macro, 2SQL will change it to [Event Procedure] and
create the VBA AfterUpdate event. This event will perform a docmd.RunMacro to run
the original macro. The event procedure will also do a me.refresh and a
me.recordset.findfirst to reset the bookmark of the recordset, if me.newrecord returns
false.
Child Table Key Changes from Forms
Form controls with controlsources that are bound to columns of child table(s) of an
updateable recordset by way of a join to a column of any of the parent tables that are
NOT a primary key, require a form refresh command in the afterupdate event.
Dependant data on the form that belongs to the child table will not display in the form
unless a form refresh occurs. In such instances 2SQL will modify the afterupdate event
of the appropriate form controls to execute a form refresh. If there is no afterupdate
event, 2SQL will modify the afterupdate property to call the built in 2SQL Macro called
RefreshForm. If the afterupdate event refers to another macro, 2SQL will change it to
[Event Procedure] and create the VBA AfterUpdate event that does a me.refresh and
then does a docmd.RunMacro of the original macro. If the afterupdate event already
referred to [Event Procedure] then 2SQL will add a me.refresh to the event.
Form Controls bound to Tables with Default Values
Form controls with a controlsources that are bound to columns of a table either directly
or by way of a query can have default values. If such cases, the Access Form engine will
propagate the default value into the form control at run time. However, Access will not
do this for tables linked to SQL Server because the default value is now a constraint in
SQL Server. When the DefaultValue property of a form control is null, 2SQL will set this
property to the original default value of the table that the form control is bound to. This
change provides identical functionality when the tables are linked to SQL Server.
2SQL Toolkit Objects
2SQL will create various tables, views, stored procedures and user defined functions that
form part of the 2SQL Toolkit, during the conversion process. These objects are needed
to provide the same functionality of the original application. For more information, see
the section about the 2SQL Toolkit in the 2SQL Toolkit Document.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 54
Optimization of Data Objects
Domain Functions
Domain Functions are converted to their equivalent 2SQL Toolkit function.
For example, DLOOKUP is converted to DLOOKUPDirect.
2SQL converts Domain Functions in both VBA Code references, and also the
controlsource property of Forms and Reports.
For more information, see the section entitled How and When to Implement the 2SQL
ExecuteScalar Utility in the 2SQL Toolkit Document, and the module called 2SQL that is
created by 2SQL for every Access database processed in Genie Mode, for more
information.
RunSQL Usage
2SQL will convert all DoCmd.RunSQL references to the ADO/OLE equivalent using the
2SQL ExecuteSQLCommand Function. For example:-
DoCmd.RunSQL SQLStatement
Becomes
ExecuteSQLCommand SQLStatement,ADODirectConnection
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 55
See the 2SQL Toolkit Document section about the 2SQL Connection Settings Utility and
the 2SQL Functions for more information.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 56
Code Alerts
When 2SQL analyses the VBA code, it will enforce compilation errors for lines of code
that require manual intervention to complete the optimization or conversion process.
For example, if an SQL Statement is used in an OpenRecordSet command as opposed to
the name of a Table, 2SQL will generate a code alert so that the code will no longer
compile until the SQL Statement is manually reviewed, remedied, and recompiled.
DAO RecordSet Variable Declarations
2SQL will convert DAO RecordSet Declarations to ADODB Recordset Declarations. For
example:-
Dim rst as DAO.RecordSet
Becomes
Dim rst as ADODB.RecordSet
DAO RecordSet Instantiations
2SQL will convert all OpenRecordSet references to the ADO equivalent using the 2SQL
ADODirectConnection Function. For example:-
Set RST = CurrentDB.OpenRecordSet(SQLStatement,dbOpenDynaset)
Becomes
Set RST = New ADODB.RecordSet
RST.Open SQLStatement,ADODirectConnection,adOpenKeyset
See 2SQL Toolkit Document section about the 2SQL Connection Settings Utility for more
information.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 57
DAO RecordSet Properties
When converting DAO Recordsets to ADO, 2SQL also converts the recordset properties
as follows:
DAO RecordSet Property ADO RecordSet Property
Batchsize Removed
Bookmarkable Supports(adBookMark)
CacheStart Removed
Connection ActiveConnection
Edit Removed
FillCache Removed
FindFirst Combination of MoveFirst,Find and EOF
FindLast Combination of MoveLast,Find and BOF
FindNext Find with AdSearchForward
FindPrevious Find with adSearchBackward
LastModified Removed
LockEdits Combination of LockType,ADODB.LockType enum
NoMatch EOF, BOF
PercentPosition AbsolutePosition*100/RecordCount
RecordStatus Status
Requery ActiveCommand
Seek Combination of adSeekEnum
StillExecuting State=adStateExecuting
Updateable Supports(adUpdate)
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 58
DAO Executes
2SQL will convert all DAO Execute references to the ADO equivalent using the 2SQL
ExecuteSQLCommand Function. For example:-
CurrentDB.Execute SQLStatement
Becomes
ExecuteSQLCommand SQLStatement,ADODirectConnection
See the 2SQL Toolkit Document section about the 2SQL Connection Settings Utility and
2SQL Functions for more information.
DAO DBEngine Commands
2SQL will convert the DAO DBEngine Transaction commands to use the 2SQL
ADODirectConnection function. For example:-
DBEngine.BeginTrans
Becomes
ADODirectConnection.BeginTrans
See the 2SQL Toolkit Document section about the 2SQL Connection Settings Utility for
more information.
ADO RecordSet Instantiations
2SQL will convert all ADO Recordset instantiations to use the 2SQL Toolkit function
called CachedADORecordset. This function allows the setting of the cachesize property
of an ADO Recordset, which can prove very beneficial for performance on large tables.
See the 2SQL Toolkit Document for more information.
Obsolete DAO Usage
2SQL will convert WorkSpaces(0).Databases(0) to CurrentDB()
CurrentProject Connections
2SQL will replace all references to the JET based CurrentProject.Connection property
with the built in
OLE based 2SQL Toolkit Function called ADODirectConnection. See 2SQL Toolkit
Document section about the 2SQL Connection Settings Utility for more information.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 59
VBA Framework
CloseQuery Calls
2SQL will replace all references to DoCmd..Close acQuery with the built in 2SQL Toolkit
function called CloseQuery2SQL. This function checks if the original query object is now
a linked table referring to a SQL Server view. If so, acQuery is replaced with acTable.
OpenQuery Calls
2SQL will replace all references to DoCmd.OpenQuery with the built in 2SQL Toolkit
function called OpenQuery2SQL. This function checks if the original query object is now
a linked table referring to a SQL Server view. If so, OpenQuery is replaced with
OpenTable. It will also call the built in 2SQL Toolkit function called
CheckQueryInputParameters. See the category called OpenQuery SetHostValue Calls for
more information.
OpenForm Calls
2SQL will replace all references to DoCmd.OpenForm with the built in 2SQL Toolkit
function called OpenForm2SQL. This function calls the built in 2SQL Toolkit function
called CheckFormInputParameters. See the category called OpenForm SetHostValue
Calls for more information.
OpenReport Calls
Same as category directly above applied to Reports.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 60
OpenQuery SetHostValue Calls
Query objects executed via DoCmd.OpenQuery may originally have had input
parameters. The values of these input parameters require posting to SQL Server via the
built in 2SQL Toolkit function called SetHostValue. 2SQL will propagate the built in
function called CheckQueryInputParameters with all the necessary calls to SetHostValue.
CheckQueryInputParameters is called from the built in 2SQL Toolkit function called
OpenQuery2SQL. See the category called OpenQuery Calls and the section called How
and When to implement to 2SQL Hosts Utility in the 2SQL Toolkit Document for more
information.
OpenForm SetHostValue Calls
The recordsource property of a form may originally have had input parameters. The
values of these input parameters require posting to SQL Server via the built in 2SQL
Toolkit function called SetHostValue. 2SQL will propagate the built in function called
CheckFormInputParameters with all the necessary calls to SetHostValue.
CheckFormInputParameters is called from the built in 2SQL Toolkit function called
OpenForm2SQL. See the category called OpenForm Calls and the section called How and
When to implement to 2SQL Hosts Utility in the 2SQL Toolkit Document for more
information.
OpenReport SetHostValue Calls
Same as category directly above applied to Reports.
Queries Longer than 60 Characters in VBA Code
2SQL will replace references to Query Names longer than 60 characters in the VBA code
with the new Query Name. See related categories for 60 character limits in other
sections of this document.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 61
Deploy to Production Environment
Recreate Table Objects and Data
2SQL will recreate all Table Schema, Data, Table Triggers and Constraints from the latest
production copy of the Microsoft Access database.
New Table Objects
Any tables in the SQL Server source back end database that are not in the Destination
database are copied across from source to destination.
HostName Tables
Tables that had the HostName column added to it during the cleanup phase of the
conversion project are detected and transferred to the destination tables. See the 2SQL
Toolkit Document section about the 2SQL Hosts Utility for more information.
User Defined Functions
2SQL will copy all User Defined Functions in the SQL Server Source back end database to
the SQL Server destination database.
Views
2SQL will copy all Views in the SQL Server Source back end database to the SQL Server
destination database.
View Triggers
2SQL will copy the Triggers of all Views in the SQL Server Source back end database to
the SQL Server destination database.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 62
Stored Procedures
2SQL will copy all the Stored Procedures in the SQL Server Source back end database to
the SQL Server destination database.
Pseudo Index Table Data
2SQL will migrate the data of the tblPseudo_Indexes table across to the destination
database. See the category called ODBC Indexes in the ODBC Connection objects for
more information.
____________________________
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 63
2SQL Version History
Version Number Major Revision Initiative
Version 3.0 Used Upsizing Wizard to create ADP front end and continued on
from where Wizard left off. SQL Server 2005/Access 2003
solution - October 2005.
Version 4.0 Completely independent of Upsizing Wizard and SSMA to provide
Server Side processing linked table solution - November 2007.
Version 4.1 SQL Server 2008/Access 2007 installer added - September 2009.
Version 4.2 Upgraded to .NET 3.5 Framework from 2.0 – January 2010.
Version 4.3 Windows 7.0 compatible – March 2010.
Version 4.4 Deploy to Production Environment conversion component
introduced– May 2010.
Version 4.5 Rollback option to migrate data from SQL Server to Microsoft
Access if problems encountered after Deploy to Production
Environment are insurmountable - August 2010.
Version 4.6 2SQL Inspector released. This utility allows users to scan their
entire network drives for Access Databases and log statistical
information to a SQL Server database repository from which
reports can be written to scope the magnitude and complexity of
Access to SQL Server projects – October 2010.
Version 4.7 Conversion Elements introduced to the 2SQL Business Model in
order to provide more flexibility to user when using built in
formulae to calculate the number of hours that 2SQL eliminates
for a conversion project. Expansion of warranty to all conversion
categories, including those that are common to Microsoft's
Upsizing Wizard and SSMA tools – December 2010.
Version 5.0 SQL Azure Ready – January 2011.
Version 5.1 SQL Server 2008/Access 2010 installer added – January 2011.
Version 5.2 Command Line options enabling 2SQL to process databases
without any user interaction – March 2011.
Version 5.3 A small number of Conversion Categories made applicable or
inapplicable depending on the version of Microsoft Access –
February 2013.
Copyright® ConvertU2 Technologies Pty Ltd in conjunction with CU2 Global Pty Ltd 2013. All rights reserved.
http://www.convertu2.comand http://www.cu2global.com All other trademarks are the property of their respective owners. P a g e | 64
Version 5.4 2SQL Inspector renamed to MSO Inspector and provided as a
module of 2SQL – January 2014.
Disclaimer
The Access to SQL conversion and migration challenge is a very complex subject. Whilst
every effort has been made to completely and accurately represent the conversion
issues and their corresponding solution, we do not claim perfection in our analysis. For
that reason we welcome reader feedback to [email protected] as part of our
commitment to continue to keep 2SQL the best product of its type on the world market
today.
____________________________