Question :
I have a view that I can run, it returns a dataset, but whenever I try to alter the view or look at its definition, I get
Error getting DDL for object
No database selected
But I do have a database selected and I can run the view with results.
How do I recover the definition? Please advise
Answer :
No database selected
error message means that no database is selected as current. Specify default database in my.ini, connection definition, or execute USE dbname;
as the very first query in the connection.
why no other view required a default schema be defined, and why is a default schema required at all? – Roy Hinkley
Default scheme needed when tablename without database name is specified somewhere in SQL text.
For example, you execute SHOW CREATE TABLE my_view
– but without default datatbase set the server does not know where it must take this view from (and even does this is a table or a view).