Re: Detect if db is empty

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

I already check for dbversion table and its structure, and if ok,
proceed with db structure update, otherwise I report db as not
compatible
Now I submit with the app a simple script that create db,
DBVersionTable and user to access the DB, which user must run in ent
manager.
I was planning to just ask user to create db only, by himself, and
then ask user to enter db name and app will check if db is new and
create dbver and all other things
And my test was to make sure uyser don't enter by mistake the name of
another db, with objects in it
But it seems I have to stick with my current approach, as it seems
more reliable

Thanks for all answers and suggestions



On 27 iul., 18:08, "John Bell" <jbellnewspo...@xxxxxxxxxxx> wrote:
"bz" <bzam...@xxxxxxxxx> wrote in message

news:5882aa24-bbff-4c33-8286-85b7d14a1375@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



Hi,

Why not check for the existance of the database and drop it or tell the
user
to enter a different name? Then you can create the database yourself and
it
will be empty.

I don't want to drop the db.
Actually, I need this for a code who runs on a web app (asp.net), to
allow to update db structure
What I planned was, when user install the app for the first time, he
will also have to create an empty DB, and a user with ddl_admin rights
(or, assign ddl_admin rights to asp.net / networkservice)
Then set the connection string in web.config to use this db and this
user (or trusted connection if using asp.net)

Then the app will connect to db. If empty, it will start to create it
(by creating first a DbVersion table, which will keep track of all
incremental updates. Then it will run a batch of DDL scripts to update
db structure to latest version used in development.

If db is not empty (brand new) and also don't have the proper
DbVersion file, app will not do anything on the db.

If prev. ver of app was installed, a prev version of db will be
available too, app will detect this (based on dbVersion table) and
will apply only corresponding update steps.

I cannot drop db, since I need to preserve user data.

Thanks
Bogdan

If sounds like the existance of your version table is all that you are
really bothered about to test if you need the intitial installation.

If the version table exists then you check the version number. If no version
exists an installation has failed.

John

.



Relevant Pages

  • Re: Detect if db is empty
    ... I would try and make the installation process as simple as possible. ... Getting users to create their own database manually and remembering the name, when you can do it for them is not making it simple! ... I already check for dbversion table and its structure, and if ok, ... Now I submit with the app a simple script that create db, ...
    (microsoft.public.sqlserver.server)
  • Re: Detect if db is empty
    ... Actually, I need this for a code who runs on a web app, to ... will also have to create an empty DB, and a user with ddl_admin rights ... DbVersion file, app will not do anything on the db. ... If sounds like the existance of your version table is all that you are really bothered about to test if you need the intitial installation. ...
    (microsoft.public.sqlserver.server)
  • Re: Detect if db is empty
    ... Actually, I need this for a code who runs on a web app, to ... will also have to create an empty DB, and a user with ddl_admin rights ... DbVersion file, app will not do anything on the db. ... If prev. ...
    (microsoft.public.sqlserver.server)
  • how to read a particular setting from a file
    ... I have a plain text file called myVersions.ver which will have something ... I will use this file to keep my app version number and database version. ... 'AppVersion' or 'DBVersion'. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Is it possible to read/write to an ini file using a tcp/ip protocal file address?
    ... In my installation routine's instructions I tell the users/network ... save the ini file holding the licence/registartion data to the same ... write my app so that it reads the ini file for the mapped drive and then ... to create a connection string like serverName:myDatabase. ...
    (comp.lang.pascal.delphi.misc)