April 28, 2016 at 9:46 am
Apologies on that!
April 28, 2016 at 10:55 am
But even if tokens are enabled, will this job do what the DBA wants it to do?
I ran an altered test scenario on my local SQL Sever. I had two steps: one to print the value of A-DBN and another to check for objects in the dbo schema newer than 90 days (I chose dbo because I don't have a maint schema).
The following messages were returned (I tried several databases including master and user databases):
Step 1 (print A-DBN)
Executed as user: NT SERVICE\SQLAgent$SQL2014. Current database name is [SQLSTATE 01000] (Message 0). The step succeeded.
Step 2 (check for objects over 90 days old and raiserror, as in the QOTD)
Executed as user: NT SERVICE\SQLAgent$SQL2014. One or more objects in the .maint schema are more than 90 days old. Review and see if they can be dropped, or moved to a different schema [SQLSTATE 01000] (Message 50000). The step succeeded.
Why was A-DBN empty? Did I mess something up or is the handsome DBA from the question going to be banging his head again once he enables tokens and this still doesn't work?
April 28, 2016 at 11:02 am
typo corrected.
April 28, 2016 at 8:08 pm
Toreador (4/28/2016)
I didn't know, so chose "I don't know", but was told that apparently I did know after all.Obviously I'm cleverer than I thought.
Made me bust out laughing.
April 29, 2016 at 3:07 am
Marcia J (4/28/2016)
Toreador (4/28/2016)
I didn't know, so chose "I don't know", but was told that apparently I did know after all.Obviously I'm cleverer than I thought.
Made me bust out laughing.
It is a paradox of Carroll proportions!!!
Gaz
-- Stop your grinnin' and drop your linen...they're everywhere!!!
April 29, 2016 at 7:31 am
I am so glad your code didn't simply DELETE the objects that it discovered!
The last IF EXISTS that I see is now looking at the 'dbo' schema... ooops!
April 30, 2016 at 7:59 am
Great question, thanks.
- webrunner
-------------------
A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html
May 2, 2016 at 7:02 am
Thanks for the question.
May 11, 2016 at 1:13 am
Great question Andy, thanks.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 9 posts - 16 through 23 (of 23 total)
You must be logged in to reply to this topic. Login to reply