how would I run a DROP DATABase SQL

chewy

SuperNintendo Chalmers
Local time
Today, 19:58
Joined
Mar 8, 2002
Messages
581
How would I run this code to delete a database?

"DROP TABLE myDatabase"

Is this more a Oracle type DB command? ie not for Access.
 
chewy said:
How would I run this code to delete a database?

"DROP TABLE myDatabase"

Is this more a Oracle type DB command? ie not for Access.

DROP TABLE myTable


myTable not myDatabase

Jon
 
that was just a typo. sorry. I have tried this in Access. Do you have to put the path where the DB is?
 
chewy said:
that was just a typo. sorry. I have tried this in Access. Do you have to put the path where the DB is?

No...the table is within the database.

Just create a temporary table called Employees
Then goto a query and click on the SQL view.
Type this in

DROP TABLE Employees;

Save the query...
run the query

Table employees is then gone!

Jon
 
OK Im the biggest idiot in the world:mad: I meant

DROP DATABASE myDatabase

This is what I actually to type
 
You want to delete a database? or a table?

Make up your mind here...

Jon
 
DROP DATABASE myDB;

you cannot be in the current database, myDB, when performing this.

Jon
 
chewy said:

I've never dropped database objects like the complete db in access...why do you need to drop a databasE? If you need to delete a file use the FSO object model.

Look up FileSystemObject..you can easily delete an .mdb or any other file using this object class.

Jon
 
do you ahve to put the full path of when it is located?
 
chewy said:
do you ahve to put the full path of when it is located?
I've only used this in SQL Server...where no path was needed. I Dont know if this is possible in access.

That is why I said use the FSO object if you want to delete a database.

Jon
 
I was just starting to get into SQL and it was listed among the other commands so was just experiminating.
 
probably not possible just gives a syntax error
 
chewy said:
probably not possible just gives a syntax error

*shrug* in access probably not possible...I know it works in SQL Server. I know you can get rid of it using FSO though.

I have a site im going to look for that allows you to practice SQL with its own recordset ... Ill see if I can find it.

Code:
CREATE PROCEDURE select_components_by_conveyor_type @CategoryID bigint
AS
BEGIN
SET NOCOUNT ON
DECLARE @reached TABLE (category bigint, subcategory bigint NOT NULL, UNIQUE(category, subcategory))
INSERT INTO @reached VALUES (NULL, @CategoryID)

   WHILE( @@rowcount > 0) BEGIN
   	INSERT INTO @reached (category, subcategory)
		SELECT DISTINCT Categories.ParentID, Categories.CategoryID FROM Categories 
		JOIN @reached AS r ON r.subcategory = Categories.ParentID WHERE Categories.CategoryID NOT IN (SELECT subcategory FROM 
                          @reached WHERE Category = Categories.ParentID)
   END

SELECT Components.ComponentID, Components.Component, Components.EnglishDescription, Components.GermanDescription, Components.AdditionalInfo
FROM Components JOIN CategoriesByComponentType ON Components.ComponentID = CategoriesByComponentType.ComponentID
JOIN @reached AS r ON CategoriesByComponentType.CategoryID= r.subcategory ORDER BY Components.Component
SET NOCOUNT OFF
END
GO

The latest SQL Stmnt :)

Jon
 

Users who are viewing this thread

Back
Top Bottom