• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
 

Microsoft (SQL Server)

on

  • 2,772 views

 

Statistics

Views

Total Views
2,772
Views on SlideShare
2,771
Embed Views
1

Actions

Likes
0
Downloads
15
Comments
0

1 Embed 1

http://www.slideshare.net 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • © 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. 06/09/09 10:09

Microsoft (SQL Server) Microsoft (SQL Server) Presentation Transcript

  •  
  •  
  • Migrating, Converting and Upsizing to SQL Server from Microsoft Access
  • Agenda
    • SSMA and Upsizing Wizard Functionality Comparison
    • ADP vs Linked Table Solution
    • Step by Step – Issues and Solutions
    • Methodology and Recommendations
    • Q & A
  • 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
  • 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
  • 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
  • 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 ?
  • SQL 2000? SQL 2005? Wizard ADP? Linked Tables? SSMA Code Modules, Forms, Reports Queries Wizard ADP? Linked Tables? Code Modules, Forms, Reports Queries Decisions, Decisions…
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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…
  • Issue - AutoNumbers generate at different update status
    • Post Update with SQL Server
    • Pre Update with Microsoft Access
      • Use SELECT @@IDENTITY as …
  • 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
  • Issue -Parameter Queries will Not Upsize
    • Requires Conversion to Parametised Stored Proc or Function
      • Careful – Views will not recognize stored procs
  • Issue - Numeric Alias
    • Requires Encapsulation with [ ]
      • Eg SELECT REF AS [10] FROM…
  • Issue - Concatenation Character
    • Will only upsize from & to + in simple SQL Statements
    • Concatenation of Numeric Fields effect spacing
      • Use LTRIM(CONVERT(varchar(255),fieldname))
  • 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
  • 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
  • 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..
  • 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
  • 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
  • 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)
  • 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%’
  • 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
  • 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
  • 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
  • Issue – VAL Function
    • Requires a UDF
      • CREATE FUNCTION VAL(@P1 VARCHAR) AS BEGIN RETURN CONVERT(INT,LEFT(@P1,PATINDEX(('%[^0-9]%',@P1+' ')-1)) END
  • 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
  • Issue – Properties that can use Access Functions
    • DefaultValue
    • Rowsource when type is Value List
    • ControlSource Property
    • VBA Code
      • Case by case assessment
  • 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
  • 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
  • Issue – RecordSource refers to Parameter Query
    • Use InputParameters Property
    • Must be Stored Proc, not a User Defined Function
      • Eg InputParameters = Forms!FormName!ControlName
  • 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
  • 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
  • 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
  • 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 ? …
  • Issue – RecordSet bound Forms
    • ADP does not support me.fieldname
    • Compilation Error
    • Requires reference to recordset
      • Me.Fieldname
      • Converts to…
      • Me.RecordSet(“FieldName”).Value
  • 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 ..
  • 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
  • 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
    • Information collected and Slides Prepared by
    • Vinayak Nandikal