Print Page | Close Window

Drop Table Or Create?

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=16962
Printed Date: 29 March 2026 at 4:41am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Drop Table Or Create?
Posted By: simoza
Subject: Drop Table Or Create?
Date Posted: 20 October 2005 at 6:00am
I've a code that guide to an installation of a database.
I would like to know if is possible with ASP e Access Db to do this:
I would like to control if the table is just existing and in this case, drop its self, before, and create a new table with:
Install_Sql = "CREATE TABLE tblst_Admin_User (id_user AUTOINCREMENT NOT NULL, username VARCHAR(30) NOT NULL, password VARCHAR(35), PRIMARY KEY (id_user))"

Conn.Execute(Install_Sql)

How, if is possible, controll if a table exist?Wacko


-------------



Replies:
Posted By: michael
Date Posted: 20 October 2005 at 9:17am
I believe in Jet you'd have to check the sysdatabases or whatever they are called first. They are hidden tables that contain table and column information.

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: simoza
Date Posted: 20 October 2005 at 11:48am
I don't know what you write... can you explain more?

-------------


Posted By: michael
Date Posted: 20 October 2005 at 1:10pm
there is not much more to explain. You need to search this forum or a search engine on how to access, Accesses  hidden databases. Then you need to figure out where in those tables you find existing user tables and write a query to check if it exists.
So, first to check what tables DO Exist something like:

SELECT MSysObjects.Name
FROM MSysObjects
WHERE (((MSysObjects.Type)=1) AND ((MSysObjects.Flags)=0));
Then if the output table contains the name you want to create it alreadt exists otherwise it does not... It's much simpler in SQL Server and there may be a better way in Access but don't know of it.


-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: simoza
Date Posted: 21 October 2005 at 4:28am
Thank you for your explainWink

-------------



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net