SQL Server has a global watch such as Sysobjects, that is, you can do SELECT directly without switching the current database. So if it is a normal table, how to implement it directly without switching the current database?
For example, I need to write a stored procedure in my database myDB. If there is an error, the stored procedure can display the error message according to @@ Error, I need this statement: select description from sysmessages where error = @@ Error
It turns out that Sysmessages and Sysobjects are also global tables, but the error message is displayed after running: The object name 'sysmessages' is invalid.
Change the above code to: select description from master..sysments where error = @@ error
Sysmessages In the database master, the master is followed by the two half-width English points. that's it.
Also want to ask the master: What are the global tables such as Sysobjects in SQL Server?