473,398 Members | 2,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Suggestions for creating new SQL Server backend from code

I'm working on upsizing an application from MS Access MDB -> MDB backend
to MS Access ADP -> SQL Server backend. The application has the ability
to create a new, empty database.

Right now all the code is generating DDL statements inside VBA and then
passing them as strings to an ADO command object. I'm going to have to
redo most of the code anyway to update it to work with SQL Server so I
wanted to think about redesigning the whole thing.

I've thought of 2 alternatives. One, having a protected folder in the
App.Path that contains a series of .SQL text files. The create new
function would then just read through each file in the folder and
execute the SQL statements it contains. Two, use SQL DMO objects to
create all the new tables.

Any other suggestions about good ways to keep this task modular and easy
to maintain?
Jan 27 '06 #1
6 3605
"Beowulf" <be*****************@hotmail.com> wrote in message
news:hUvCf.151$Cf7.56@trnddc06...
I'm working on upsizing an application from MS Access MDB -> MDB backend
to MS Access ADP -> SQL Server backend. The application has the ability
to create a new, empty database.

Right now all the code is generating DDL statements inside VBA and then
passing them as strings to an ADO command object. I'm going to have to
redo most of the code anyway to update it to work with SQL Server so I
wanted to think about redesigning the whole thing.

I've thought of 2 alternatives. One, having a protected folder in the
App.Path that contains a series of .SQL text files. The create new
function would then just read through each file in the folder and execute
the SQL statements it contains. Two, use SQL DMO objects to create all
the new tables.

Any other suggestions about good ways to keep this task modular and easy
to maintain?

You don't mention what benefit you might hope to gain from either of these
two different approaches. One involves extra text files and tryig to
protect them by puting them in a special folder and the other needs relies
on additional components being installed which may or may not be on the
client pc.
It would seem to me, that by having the actual commands in your vba coding,
you have tight control over the content and can use error handling to make
sure you know exactly what is happening. By all means you could cheat and
use Enterprise Manager to create the scripts, but I would incorporate them
in a vba module with a top level function such as Public Function
CreateBlankDb(strServer As String) As Boolean. The function would contain
other functions each returning True/False to indicate whether they were
successful - to create the tables, the indexes, relationships, etc.
Jan 29 '06 #2
Anthony England wrote:
"Beowulf" <be*****************@hotmail.com> wrote in message
news:hUvCf.151$Cf7.56@trnddc06...
I'm working on upsizing an application from MS Access MDB -> MDB backend
to MS Access ADP -> SQL Server backend. The application has the ability
to create a new, empty database.

Right now all the code is generating DDL statements inside VBA and then
passing them as strings to an ADO command object. I'm going to have to
redo most of the code anyway to update it to work with SQL Server so I
wanted to think about redesigning the whole thing.

I've thought of 2 alternatives. One, having a protected folder in the
App.Path that contains a series of .SQL text files. The create new
function would then just read through each file in the folder and execute
the SQL statements it contains. Two, use SQL DMO objects to create all
the new tables.

Any other suggestions about good ways to keep this task modular and easy
to maintain?
You don't mention what benefit you might hope to gain from either of these
two different approaches. One involves extra text files and tryig to
protect them by puting them in a special folder and the other needs relies
on additional components being installed which may or may not be on the
client pc.


The benefit, as I see it, is that the load procedures would be basically
agnostic about the data structure. They just read a directory and do
what it says. Also, I wouldn't have to change code, recreate and
redistribute an ADE file if I make changes. I also already have a
number of SQL files that I've generated over the past month or so while
setting up the SQL Server database that I created from SQL Query Analyzer.
It would seem to me, that by having the actual commands in your vba coding,
you have tight control over the content and can use error handling to make
sure you know exactly what is happening. By all means you could cheat and
use Enterprise Manager to create the scripts, but I would incorporate them
in a vba module with a top level function such as Public Function
CreateBlankDb(strServer As String) As Boolean. The function would contain
other functions each returning True/False to indicate whether they were
successful - to create the tables, the indexes, relationships, etc.


You're probably right. Given that if I am changing the structure of the
database, that I'm probably also going to need to make other changes
elsewhere in the app, the benefit I was hoping to gain from the SQL
Files method is probably illusory.
Jan 29 '06 #3
I assume you do know that you can import the tables into the ADP's
MS-SQL backend with no SQL at all:

DoCmd.TransferDatabase acImport, "Microsoft Access", "Northwind.mdb",
acTable, "Customers", "Customers", True

and that you can export them from the mdb to the ADP MS-SQL with no SQL
at all:

DoCmd.TransferDatabase acExport, "Microsoft Access", "FFDBABooks.adp",
acTable, "Employees", "Employees"
(Yes, [Microsoft Access] works with an ADP)

This way you do not need any pre-written SQL (You can use OpenSchema to
get a list of table names.)

I realize you may not get the column definitions as you want them. You
could upgrade those later.

Jan 29 '06 #4
Lyle Fairfield wrote:
I assume you do know that you can import the tables into the ADP's
MS-SQL backend with no SQL at all:

DoCmd.TransferDatabase acImport, "Microsoft Access", "Northwind.mdb",
acTable, "Customers", "Customers", True

and that you can export them from the mdb to the ADP MS-SQL with no SQL
at all:

DoCmd.TransferDatabase acExport, "Microsoft Access", "FFDBABooks.adp",
acTable, "Employees", "Employees"
(Yes, [Microsoft Access] works with an ADP)
I used Access's Upsizing Wizard to get the tables into my "seed"
database on SQL Server 2000 that I'm using for development testing. I'm
primarily concerned at the moment with translating a function of the
original application where it could create empty MDB files at the
request of the user.

This function no longer applies now that the backend is in SQL Server so
I'm exploring options for implementing the same functionality with the
new ADP front/SQL Server 2000 backend configuration.
This way you do not need any pre-written SQL (You can use OpenSchema to
get a list of table names.)

I realize you may not get the column definitions as you want them. You
could upgrade those later.


I wasn't aware of this capability of the TransferDatabase command. I
was only familiar with it as a tool for importing/exporting text. This
nugget of information may come in handy in the future regardless.
Thanks for your comments.
Jan 31 '06 #5
Beowulf wrote:
I'm
primarily concerned at the moment with translating a function of the
original application where it could create empty MDB files at the
request of the user. From an ADP connected to Database Temp on Server FFDBA\SQLExpress


I run this code

DoCmd.TransferSQLDatabase "FFDBA\SQLExpress", "Temp2", , , , False

A new copy (without data) of Temp called Temp2 is created on
FFDBA\SQLExpress.

Jan 31 '06 #6
"Lyle Fairfield" <ly***********@aim.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Beowulf wrote:
I'm
primarily concerned at the moment with translating a function of the
original application where it could create empty MDB files at the
request of the user.

From an ADP connected to Database Temp on Server FFDBA\SQLExpress


I run this code

DoCmd.TransferSQLDatabase "FFDBA\SQLExpress", "Temp2", , , , False

A new copy (without data) of Temp called Temp2 is created on
FFDBA\SQLExpress.

Well you certainly can't get much quicker than that! I had never used this
as I don't have any adp's in production - but I just tried it and have still
not managed to make it work. The first error involved invalid user accounts
which were transferred from a previous domain and should have been deleted
anyway - so this was an easy fix. The second error was a bit more obscure
and I still need to fix it but it is related to this post:
http://groups.google.com/group/comp....ab321f52403115
The third error is caused by running this code for a second time, which does
not allow you to delete the first copy and replace it with a second, so you
have to find another way to check and prompt whether to overwrite. With all
of these little things, you have no fine control over what happens and you
only have one line of code to succeed or fail, and if it does fail, you may
well be left with a partially completed database.

What this method does is to try and create a copy of what is currently there
and as I have found out, there may be objects present that shouldn't be
there for whatever reason. Perhaps some person or process has screwed
things up and you want to start again with a fresh database with objects as
they should be, not a copy of the current situation.

I suppose it's fairly obvious really: the built-in method is quick and easy
but offers no flexibility. Building you own function, is a lot more work
but you would have much tighter control over what happens.
Jan 31 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: santhosh_176 | last post by:
:I Created a Pocket PC application for iPAQ 5450. Every thing went fine even installer creation. I could run the setup and install it into the actual device and worked fine. The application enables...
29
by: Mark B | last post by:
We have an Access app (quite big) at www.orbisoft.com/download. We have had requests by potential users to have it converted to an SQL version for them since there corporate policy excludes them...
4
by: nepdae | last post by:
Well, after reading and hunting all over the web, including here, I still haven't been successful in my attempts to resolve my situation. So, I thought maybe I'd just ask. Here's the situation: ...
18
by: rdemyan via AccessMonster.com | last post by:
Here's my plan for creating nightly backups of the production back-end file (the IT staff in their infinite wisdom have prevented use of Windows Scheduler and users do not have administrative...
13
by: Jan | last post by:
Hi: I'm working on my first SQL Server-backend application and am already running into trouble. This is an application that has run successfully with a Jet backend, and I'm starting out by...
3
by: Jim Devenish | last post by:
A number of people design systems with an Access front-end linked to a SQL Server backend. Can anyone please recommend any good books which set out how to do this? I am interested to learn the...
9
by: jyothi1105 | last post by:
Hi all, Here is some information which could help people who want to create stored procedures and execute them in their program. You can create stored procedures in two ways: Through front end...
1
by: Salad | last post by:
If one distributes a front/backend app is there a good practice for refreshing the links? I was thinking that the first time the user enters the app, it could check for any tables. If the...
10
by: gary0gilbert | last post by:
An unusual spin to this recurring disk or network error in a Terminal Server environment. Access 2000, Terminal Server 2000, file server is windows 2000. All users have a separate copy of the...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.