Results 1 to 9 of 9
  1. #1
    erich_18 is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2018
    Posts
    11

    Migrating Calculated Fields Access BE to SQL Server

    Hi All,



    I'm currently migrating my access back end tables (.accdb) to SQLExpress 2017 using the SQL server migration application.

    I've successfully migrated the tables and connected my access front ends to the SQL back end.

    but one of the access table did not completely migrate to SQL server, it did not copy the calculated fields (I believe called computed columns) to SQL.

    after repeating the whole migrating process I noticed some warning on that particular table. attached an image.

    here's how the calculating fields work in access

    [BAF] the variable that when updated then additional columns are automatically updated:

    [20OFRFULL] is a fixed value no formulas here.
    [20BAFFULL] is a calculated field. formula here is: [BAF]*[20OFRFULL]
    [20TTLFULL] is a calculate field. formula here is: [20OFRFULL]+[20BAFFULL]

    not sure why the assistant does not copy these columns as such. the warnings state that there's problems in the column names but my column names do not have any special characters nor any reserved words.

    I tried to manually add the formula in SQLServerManagement but no luck.

    any ideas on how I can get the assistant to copy the calculated fields formulas to SQL ?

    tks

    Eric
    Click image for larger version. 

Name:	Capture.jpg 
Views:	28 
Size:	146.0 KB 
ID:	36031


  2. #2
    erich_18 is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2018
    Posts
    11
    figured out the problem. I cannot reference a computed column to another computed column. I'll update my post once I find the solution.

    thanks all.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    Access Calculated field can reference another Calculated field. However, AFAIK, SQLServer does not have table level calculated fields and Access is the only db platform with this feature. Solution is to not use calculated fields in Access table, do calcs in query.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Quote Originally Posted by June7 View Post
    However, AFAIK, SQLServer does not have table level calculated fields and Access is the only db platform with this feature.
    https://docs.microsoft.com/en-us/sql...ql-server-2017
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    Ah, looks like enhancement as of SQLServer 2016. Now re-educated. So SQLServer doesn't allow calculation with calculated field. Conversion of Access table with Calculated fields still not straightforward. Too bad.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Calculated fields have been available in SQL for ages , they certainly work in SQL 2008. https://www.mssqltips.com/sqlservert...sisted-values/

    However what SQL won't like is field names beginning with numbers.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    Rats! Then I have always misunderstood the argument against calculated fields in Access was because calculated fields were not in SQLServer. They are there but there is incompatibility when migrating?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Minty, have you used them? A while back I thought "hey, I'll add a FullName computed column that concatenates the first and last name". I did and the data looked fine. An hour later a user is getting an error, turns out new records couldn't be added to the table. I didn't care enough to research, just deleted the field (it was a mature app, nothing depended on that field). Curious what would have caused the table not to accept new records just because of that field.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Hi Paul, I think I have somewhere, but can't remember how successful the implementation was.

    I'll have a dig around - funnily enough, I believe that the First Name + Last name was one of my attempts... It's lack of working may have been unhandled nulls.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Migrating tables to SQL Server
    By Joakim N in forum SQL Server
    Replies: 15
    Last Post: 04-14-2017, 03:09 PM
  2. Error when migrating Access database to SQL Server
    By AnneForumer in forum Import/Export Data
    Replies: 1
    Last Post: 11-18-2016, 10:24 PM
  3. Replies: 4
    Last Post: 05-04-2016, 06:59 AM
  4. Migrating Access to SQL Server using an ODBC
    By cbende2 in forum Tutorials
    Replies: 2
    Last Post: 07-06-2015, 06:44 AM
  5. Replies: 0
    Last Post: 12-01-2011, 10:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums