Cannot create a new table after “DROP SCHEMA public”

The error message pops up when none of the schemas in your search_path can be found. Either it is misconfigured. What do you get for this? SHOW search_path; Or you deleted the public schema from your standard system database template1. You may have been connected to the wrong database when you ran drop schema public … Read more

MySQL bulk drop table where table like?

You can use prepared statements – SET @tables = NULL; SELECT GROUP_CONCAT(‘`’, table_schema, ‘`.`’, table_name,’`’) INTO @tables FROM information_schema.tables WHERE table_schema=”myDatabase” AND table_name LIKE BINARY ‘del%’; SET @tables = CONCAT(‘DROP TABLE ‘, @tables); PREPARE stmt1 FROM @tables; EXECUTE stmt1; DEALLOCATE PREPARE stmt1; It will generate and execute a statement like this – DROP TABLE myDatabase.del1, … Read more

What is the syntax to drop a Stored Procedure in SQL Server 2000?

Microsoft recommended using the object_id() function, like so: IF EXISTS (select * from dbo.sysobjects where id = object_id(N'[dbo].[YourProcedure]’) and OBJECTPROPERTY(id, N’IsProcedure’) = 1) DROP PROCEDURE [dbo].[YourProcedure] GO . object_id() helps resolve owner conflicts. If you do SELECT name FROM sysobjects WHERE name=”my_procedure” , you may see many different procedures with the same name — all … Read more