Thanks for the help. Wednesday, July 13, PM. I am also having this same error. After running the select query above I am given one row. Monday, July 25, AM. I resolved this by restarting the SQL server. Wednesday, July 27, PM. Thanks Hemanshu. Wednesday, November 2, PM. Thanks for sharing this Jerome. Iw as able to alter a few things on my end to make my scripts run correctly from this.
Wednesday, February 29, PM. You can resolve object names in the context of another database by specifying a database ID. The following example returns columns from the sys. The following example returns the object schema name, object name, and SQL text for all cached query plans that are not ad hoc or prepared statements. The following example returns the database, schema, and object name along with all other columns in the sys.
Your object number in the example below will be different. Skip to main content. Ask Question. Asked 8 years, 3 months ago. Active 4 years ago. Viewed 4k times. Improve this question. Aaron Bertrand k 25 25 gold badges silver badges bronze badges. From BOL technet. Kin that's true, but since he issues a USE command, it might not be altogether intuitive from the docs why the "current database context" is not msdb.
Add a comment. Active Oldest Votes. Improve this answer. Aaron Bertrand Aaron Bertrand k 25 25 gold badges silver badges bronze badges.
Thanks, this solved my problem. I tried reconnecting to the server and trying the function on different DBs, but I am getting the same results. Does anyone know why this would occur? One possible problem is that you are in the wrong database.
The "id" is database specific, so the real key is ", ". If you pass in a three-part name, then it will resolve in any database you are in. If you pass in a one-part name, then it tries to resolve it in the current database. If not found, you get NULL. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow.
0コメント