MS SQL Server: Support access to DB objects in connection's non default DB#376
Conversation
There was a problem hiding this comment.
Hmm, I think this has side effect: the current database is changed; and if something dies - it will remain in the new database.
What about just modifying the query above from sys.columns to something like objectDatabaseName.sys.columns?
|
Ah. I've just noticed that I've not checked in the other bit of code that reverts the DB back to the value that I capture in However, your suggestion seems to work perfectly and is much more elegant (and I'm embarrassed I didn't think of it in the first place! 😳). I'll run the tests over it. |
|
Hmm. This does involve changing both |
|
Also tidied up the DB setup script whitespace (we've no style guide for the SQL code - I generally use Steven Feuerstein-like formatting). |
There was a problem hiding this comment.
That snippet is basically the same as the other. Maybe we can move it to a single place?
c30f775 to
caead22
Compare
|
Do you think it would be better to distribute the tests in the new page I've created into other, existing, test pages or to have an explicit test page for this? |
|
A separate test page seems OK to me. |
There was a problem hiding this comment.
In the existing code seems we don't have such blank lines after the method header. And right now to me it looks a bit better without this extra line.
|
Ok. Extra blank lines fixed. |
|
Now it looks good to me. Might be good to just to clean up the commit history and we can merge then. |
1658852 to
522f02b
Compare
522f02b to
917da59
Compare
|
I've squashed to a single commit and rebased. |
…fault-db Support access to DB objects in connection's non default DB
Add support for access to objects that are not in the current database for the connection/session using the full 3 part name.
Users currently have to rely upon either the default database for the connection (specified for each DB user, or overridden for the connection using either the
database=ordatabaseName=connection parameter), OR, set the default database using aUSE <db name>SQL statement.