Loading...
Flash Player 9 (or above) is needed to view slideshows. We have detected that you do not have it on your computer.To install it, go here
-
xgijon favorited this 9 months ago
Migrate Microsoft Access to SQL Server
Describes with notes Microsoft Migration Tools and manual steps required to migrate a Microsoft Application to an Access Data Project (ADP) with a SQL Server back-end
14867 views | comments | 1 favorites | 390 downloads | 4 embeds (Stats)
More Info
This slideshow is Public
Total Views: 14867 on Slideshare: 14840 from embeds: 27
Most viewed embeds (Top 5):
More
Slideshow Transcript
- Slide 2: Migrating, Converting
and Upsizing to SQL
Server from Microsoft
Access
Name – Stephen Koop
Title - Principal Technologist
ConvertU2
- Slide 3: Agenda
SSMA and Upsizing Wizard Functionality
Comparison
ADP vs Linked Table Solution
Step by Step – Issues and Solutions
Methodology and Recommendations
Q&A
- Slide 4: SSMA for Access
Converts “Simple” SELECT queries only
Does not support ADP solutions…when ?
Comprehensive Data/Schema Analysis
Reports on issues to address before upsizing
Multi Database upsizing
Reports on issues to address post upsizing
Several bugs in Wizard fixed – which ones ?
Restricted to SQL Server 2005 and .NET 2.0
- Slide 5: Access 2003 Upsizing Wizard
Supports both ADP and Linked Table Solution
No pre analysis reporting
Comprehensive Documentation from Microsoft
and Third Parties
ADP Solution creates framework only – no
syntax or code fixes in Forms, Reports and
Modules
- Slide 6: Access Data Project Solution
True Client Server
End User Transparency
Same Complexity, Different Rules
Most significant performance boost
Gateway to Web Enabled Solutions
Leverages SQL Server the most
- Slide 7: Linked Table Solution
Not a Client Server Environment
Slower Performance (sometimes drastically)
Much Less Versatility
Design changes may be required to increase
performance
Interface changes require end user retraining
Not for complex Access Databases
Less work, but more compromise
Access 2007 ?
- Slide 8: Decisions, Decisions…
SQL 2000? SQL 2005?
Wizard
Linked Tables?
ADP?
SSMA
ADP? Linked Tables? Wizard
Queries Queries
Code Modules, Code Modules,
Forms, Reports Forms, Reports
- Slide 9: Complexity vs Time
Data and Schema is typically 10% of ADP project
Queries, Forms, Reports and Modules = 90%
100 Objects or Less – Not complex
200 Objects – Complex
500 Objects – Very Complex
1000 Objects – Extremely Complex
Reduce by 50%+ with knowledge and strategy
Use third party toolsets
- Slide 10: Step by Step – Issues and Solutions
Access Data Project Conversion Issues
Encompasses Linked Table Solution
Undocumented Issues straight from the field
Expansion on Current Documentation
Design Changes to make it all work
Code Samples
Wiser and Smarter to the Challenge
Let’s get into it
- Slide 11: Issue - SQL Server does not know
who you are
But Access did !!
@@SPID to the rescue
ADO and Form SPIDS are different
Create Table with SPID and Access UserID columns
Initialise at Logon
Delete previous Login Rows for SPID
SELECT COL1 FROM TABLE WHERE SPID =
@@SPID
- Slide 12: Issue - Reserved Words
Table Names, Column Names, Alias references
Wizard tolerates some, not others when creating
tables and converting queries
SQL Server tolerates some, not others
Fixed in SSMA for CREATE TABLE (Reserved
Word) Tablename!!!
Encapsulate references in SQL Statements with [ ]
where possible
Otherwise Rename and Identify cascading effect
- Slide 13: Issue - Table Relationship Rules
Fields must be same length
Wizard demands same field name
Part of SSMA Reporting !
Remove Relationship
Remove Index
Change Field Size to Highest Length
Reinstate Index
Reinstate Relationship
- Slide 14: Issue - Date Fields can be Corrupt
or Invalid in Access
Wizard will not upsize tables with column dates
less than 01/01/1900 or greater than 31/12/2078
Fixed in SSMA !! For dates out of range
Compounded if no Format Property
Remove Rows with Dates out of Range
Or change to 31/12/2078, upsize and review later
- Slide 15: Issue - Tables without Unique Index
will not Upsize
Simple Solution
Part of SSMA Reporting !!
Create AutoNumber Primary Key
Or add Primary or Unique Index to existing field if
design is not compromised by doing so
- Slide 16: Issue - Memo Fields get Converted
to Ntext
Restrictions apply in SQL Statements
Cannot Sort, Compare, or use as part of
DISTINCT
Use CONVERT
Eg SELECT DISTINCT Convert(varchar,[fieldname]) as
[fieldname] FROM…
- Slide 17: Issue - AutoNumbers generate at
different update status
Post Update with SQL Server
Pre Update with Microsoft Access
Use SELECT @@IDENTITY as …
- Slide 18: Issue - Random AutoNumbers on
Primary Key
Wizard Generates Trigger and zero Default
Value Constraint
Primary Key Violation
Not a common issue
Delete the trigger
Remove 0 Default Value
Create Identity of Increment 1 and Seed 1
- Slide 19: Issue -Parameter Queries will Not
Upsize
Requires Conversion to Parametised Stored
Proc or Function
Careful – Views will not recognize stored procs
- Slide 20: Issue - Numeric Alias
Requires Encapsulation with [ ]
Eg SELECT REF AS [10] FROM…
- Slide 21: Issue - Concatenation Character
Will only upsize from & to + in simple SQL
Statements
Concatenation of Numeric Fields effect spacing
Use LTRIM(CONVERT(varchar(255),fieldname))
- Slide 22: Issue - Double Quote Literal String
Will only upsize from double quote to single in
simple SQL Statements
Difficult to identify in VBA Code
Replace line of code with double quotes to single and
force compile error
Manually fix until compilation is achieved
- Slide 23: Issue - ORDER BY
Requires Reference in Select Clause
SELECT COL1 FROM TABLE ORDER BY COL2
Converts to
SELECT COL1,COL2 FROM TABLE ORDER BY COL2
Or refer to subquery containing ORDER BY to hide
COL2
- Slide 24: Issue - UPDATE Queries
Will not upsize
JOINS must occur after FROM Clause
UPDATE TABLE INNER JOIN…SET…
Converts to
UPDATE TABLE FROM TABLE INNER JOIN…SET..
- Slide 25: Issue – Views with ORDER BY
Will not upsize
Requires (Superfluous) TOP 100 PERCENT
STILL an ISSUE with SQL Server 2005
SELECT TOP 100 PERCENT * FROM… ORDER BY
- Slide 26: Issue – UPDATE View instead of
Table
Will not function for Views with TOP OR ORDER
BY
Create a base view without TOP and ORDER BY
UPDATE the base view
Create new view with TOP and ORDER BY referring to
base view
- Slide 27: Issue – Partial Inserts with Unique
Constraints
Not Supported in SQL Server
Transaction will not occur, ie all or nothing
INSERT INTO TABLE1 (COL1) FROM SELECT COL2
FROM TABLE2
Append the following condition
WHERE NOT EXISTS(SELECT COL1 FROM TABLE1
WHERE COL1 = COL2)
- Slide 28: Issue - WILDCARDS
Will only upsize for Simple SQL Statements
Requires Ansi89 conversion to Ansi92
Eg LIKE ‘*SMITH’ converts to LIKE ‘%SMITH’
Eg LIKE ‘SMITH’ converts to LIKE ‘%SMITH%’
- Slide 29: Issue – Criteria referring to Date
Literals
Will not upsize
# Symbol requires conversion to single quote
Month and Day Sequence can conflict with
Locale Settings of SQL Server
CLNG(datefield) in VBA requires formatting
Use mmm syntax in SQL Statements -
Use Format(xxx,’.. MMM..’) in VBA Code refs
- Slide 30: Issue - Boolean References
Will only upsize for simple SQL Statements
TRUE, FALSE, YES, NO are not recognized
= -1 for True will compile but will malfunction
True or -1 converts to =1 or <> 0
False converts to =0 or <> 1
ADO converts bit fields back to True/False in
Recordsets
- Slide 31: Issue - Access Functions in SQL
Statements and Object properties
Many are not supported – UDF required
Others Require syntax change
In Particular…
VAL
FORMAT
TRANSFORM
FIRST & LAST
- Slide 32: Issue – VAL Function
Requires a UDF
CREATE FUNCTION VAL(@P1 VARCHAR) AS
BEGIN RETURN
CONVERT(INT,LEFT(@P1,PATINDEX(('%[^0-
9]%',@P1+' ')-1)) END
- Slide 33: Issue – FIRST ,LAST and
DLOOKUP Functions
AutoNumber or DateTimeStamp dependancy
Solution Can effect performance
SELECT LAST(COL1) FROM TABLENAME
Converts to..
SELECT COL1 FROM TABLENAME WHERE AUTOID
= (SELECT MAX(AUTOID) FROM TABLENAME)
Similar concept for DLOOKUP using COUNT instead of
MIN/MAX
- Slide 34: Issue – Properties that can use
Access Functions
DefaultValue
Rowsource when type is Value List
ControlSource Property
VBA Code
Case by case assessment
- Slide 35: Issue - Alias References
Cannot be referred to elsewhere in SQL
Statement
Requires reference to alias definition, not alias
SELECT 5 AS A, 10 AS B, CASE WHEN C = 1 THEN A
ELSE B END
Converts to
SELECT 5 AS A, 10 AS B, CASE WHEN C = 1 THEN 5
ELSE 10 END
- Slide 36: Issue – Form and Report Controls
Forms!FormName!ControlName is not
recognized by SQL Server
Requires conversion to parametised stored proc
or function
Pass Forms!Formname!ControlName as parameter
- Slide 37: Issue – RecordSource refers to
Parameter Query
Use InputParameters Property
Must be Stored Proc, not a User Defined
Function
Eg InputParameters = Forms!FormName!ControlName
- Slide 38: Issue – Rowsource refers to
Parameter Query
Must be Stored Proc, not a User Defined
Function
But where do the parameters go ?
Use VBA Enter Event Procedure Override
ControlName.Rowsource = “Exec ProcName “ &
Forms!FormName!ControlName
- Slide 39: Issue – VBA User Defined
Functions
Not recognized by SQL Server
Requires VBA UDF conversion to SQL Server
UDF
Generate SQL Server UDF Template(s) First
Upsize Queries
Develop Functional SQL Server UDF
- Slide 40: Issue – Encapsulated references in
WHERE clause that are not an Alias
and not a Column
These are undefined input parameter fields
Convert to Parametised Stored Proc or Function
Don’t forget if RecordSource or Rowsource
- Slide 41: Issue - The DAO Programming
Library
Is not Supported for Access Data Projects
DAO must be converted to ADO
Completely Documented by Microsoft and Third Parties
StraightForward, but not a global search and replace
solution
Remove DAO reference and add ADO reference
Fix until code compiles
Won’t Compile ? Won’t Run ? …
- Slide 42: Issue – RecordSet bound Forms
ADP does not support me.fieldname
Compilation Error
Requires reference to recordset
Me.Fieldname
Converts to…
Me.RecordSet(“FieldName”).Value
- Slide 43: Issue – RecordSet Find
FIND Property of RecordSet cannot refer to AND
or OR
Requires MOVEFIRST if converted from DAO
FindFirst
Use the Filter property for multiple criteria Finds
Write a VBA Function to encompass both scenarios
Sample Code ..
- Slide 44: Issue - DOCMD
Acquery constant no longer applies
Requires Conversion to SQL Server Equivalent
OpenQuery, SelectObject, DeleteObject,
ApplyFilter
eg OpenQuery converts to OpenServerView
Acquery converts to acStoredProcedure,acView or
acFunction
Solution -Use Type and Name columns of SysObjects
ApplyFilter requires conversion to ANSI92
- Slide 45: Methodology and
Recommendations
Don’t jump in cold when your application is
complex
Know the traps and pitfalls
Learn the tips and tricks
Scan Scan Scan – write (DAO) scripts to find the issues
Identify and Track the cascading effect
Management , Knowledge and strategy will ensure
successful migration
- Slide 46: IT’S ALL ON OUR WEB SITE
WWW.CONVERTU2.COM
Can’t Solve an Upsizing, Migration, or
Conversion Issue ?
ASK US
- Slide 47: © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be
interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.