| By Eron Cohen, Michael Smith | Article Rating: |
|
| April 27, 2001 12:00 AM EDT | Reads: |
11,584 |
In March (CFDJ, Vol.3, issue 5) we covered reasons to upsize your Access database to SQL Server and the tools you'll use to do it. Here we explain in detail how to copy data to SQL Server and troubleshoot your upsizing project.
The IMPORT AND EXPORT data wizard (aka the DTS Wizard - Data Transformation Services) certainly helps get you going with building tables in SQL Server. It takes an Access database (as well as many other database types) to import its table structures and data to a Microsoft SQL Server. Since it uses a wizard format, it's simple to use as long as you know what data you want to transform. To start the wizard choose START > MSDE > IMPORT AND EXPORT DATA or START > Microsoft SQL Server 7.0 > IMPORT AND EXPORT DATA.
On the first data-gathering screen (see Figure 1) you'll be prompted for information about the data source. Choose Microsoft Access from the drop-down menu for the data source (or whatever is appropriate for the database you actually intend to import to SQL Server. You'll find quite a long list of possibilities). Then select the appropriate .MDB file and type your username and password if necessary. When you're finished, click the NEXT > button to continue on to set up the destination database.
On this page you'll most likely leave the destination database on the default Microsoft OLE Provider for SQL Server. This is the selection you'd normally use to import the MS Access database you chose on the previous page of the wizard into a SQL Server database. Next you'll need to provide the name of the server and the security information. Typically this information is provided to you by your system administrator or by the Web-hosting company that houses your SQL Server. Once this information is correct, you'll be able to select the actual database you wish to import the tables into.
If you haven't already created a database to house your new data, choose
Transformation
On the last page of the wizard you'll be able to select when the import should be executed. You'll probably want to choose "Run Immediately" and just choose NEXT>. Finally, press FINISH and watch the action. If anything goes wrong on the data import, the wizard will let you know what the problems were. You'll need to fix them in the Transformations and then retry the tables that failed. Referential integrity can complicate the process of retrying individual tables. If life becomes too complicated, consider dropping the referential constraints for the tables in question and re-creating the constraints after the upgrade. When you're done we suggest you review the table structure in the design table view. You'll probably want to at least add the primary key constraint by clicking on the key symbol to your key field and look at which fields allow nulls. You might also check the Identity box if your key field was AutoNumber in Access and pick some fields to index. It's a good idea to look at the data by right-clicking on the table and doing the action "open all records" to make sure nothing went wrong.
Finding and Troubleshooting Upgrade Problems
Field and Table Names
SQL and Function Differences
Changing SQL and Access Queries
Access Queries become Views in SQL Server. To convert a query to a view, cut and paste from the Access SQL view into SQL Server's View creation designer. Just be aware that, unlike Access queries, they can't use an ORDER BY clause - you'll need to do the ordering when you run the view SQL in ColdFusion. The view designer can also be useful when you want to test some SQL from ColdFusion to find out why it has a syntax error. Alternatively, you may choose to create a stored procedure for a query, especially if you need to parameterize the WHERE clause. Stored procedures also let you code multiple queries and procedural code such as IF statements inside SQL Server.
Summary
Resources
Now you'll be given a list of the tables in your database. Notice that you won't be given the names of any queries or reports. Choose the individual tables you wish to import or just press the SELECT ALL button. As you select the tables, a field activates that will allow you to change the name of the destination table. Do so if necessary. There's also a Transform button that will allow you to make changes to the table's structure as it is being brought into the new SQL Server table. If you transform anything, you'll want to be aware of the new data types available in SQL Server but not in MS Access. There are some confusing things. For instance, a Text field in Access is similar to an NVARCHAR or VARCHAR data type in SQL Server. On the other hand, a Text field in SQL Server is like a memo field in MS Access. Please check your SQL Server references for more specifics on these data types and their exact characteristics.
After you've finished importing your data, you'll need to test your queries thoroughly. There are a few differences between MS Access's version of SQL and the implementation that SQL Server uses.
Field Types
The syntax for some SQL statements, functions, and operators is different between Access and SQL Server (see Table 1).
If you have ColdFusion Studio, use the extended search to find where these problems may occur and deal with them. For instance, the above-mentioned problem with DELETE * could be dealt with by simply doing an extended search for DELETE * and replacing it with DELETE. However, be careful with function names that are in both Access SQL and ColdFusion, such as ucase() and #ucase()#, because you only want to change the Access SQL function to upper()! We suggest you carefully watch your ColdFusion application server log after switching over to find any issues you may have missed.
Upgrading to SQL Server may sound intimidating, but Microsoft has provided tools to ease your way. Many SQL Server interfaces either look similar to Access or can be administered using Access as a front end. Upgrading to SQL Server is a big step, but the payoffs are well worth it for ColdFusion programmers. Plus, the MSDE version of SQL Server is free with Office! As you get used to SQL Server, you'll find it superior to Microsoft Access in many ways, and you'll have an excellent addition to your résumé!
Published April 27, 2001 Reads 11,584
Copyright © 2001 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Eron Cohen
Eron Cohen is a ColdFusion programmer, MDCFUG speaker, and author.
More Stories By Michael Smith
Michael Smith is president of TeraTech (www.teratech.com/), an
11-year-old Rockville, Maryland-based consulting company that
specializes in ColdFusion, database, and Visual Basic development.
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Adobe Flex Developer Earns $100K in New York City
- Adobe LiveCycle Enterprise Suite 2 for Cloud Computing
- Adobe Betas Target RIAs and Cloud Computing
- Adobe Cans Another 9% of its Workforce
- Moyea DVD4Web Converter V2.0 Converts DVD to FLV Fast and Synchronously with Watermarks
- Adobe Fiddles with its Web Apps
- Adobe & Salesforce Cut Cloud Deal
- Hosting.com Launches ColdFusion 9 in the Cloud
- The Real Time Infrastructure Ultimatum
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Eval JavaScript in a Global Context
- Fig Leaf Software to Exhibit at Government IT Conference & Expo
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Is Microsoft as Free as Open Source?
- Adobe Reader Sued
- The Planet Named “Bronze Sponsor” of Cloud Computing Expo
- Microsoft Expression Web Has Got Game
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Adobe Flex Developer Earns $100K in New York City
- Bruce Chizen Joins Voyager Capital as Venture Partner
- My Top Seven Wishes From Adobe MAX 2009
- The Next Programming Models, RIAs and Composite Applications
- Where Are RIA Technologies Headed in 2008?
- Constructing an Application with Flash Forms from the Ground Up
- AJAX World RIA Conference & Expo Kicks Off in New York City
- CFEclipse: The Developer's IDE, Eclipse For ColdFusion
- Personal Branding Checklist
- Adobe Flex 2: Advanced DataGrid
- Has the Technology Bounceback Begun?
- Building a Zip Code Proximity Search with ColdFusion
- i-Technology Viewpoint: We Need Not More Frameworks, But Better Programmers
- The Asynchronous CFML Gateway
- Web Services Using ColdFusion and Apache CXF




























