How do I find out if Sql server Agent's login has rights to a DB?

How do I find out if the SQL server Agent's login has rights to the target DB, that is the DB on which I will be executing a query ? Is there a query for this ?
Thanks.

The job will run with the permissions of owner of the job and only be modified by the owner
or sysadmin role members.
you need get the owner of the job and for example 'ABC' is the owner of the job then pass value in the below query 
DECLARE @DBuser_sql VARCHAR(4000) 
DECLARE @DBuser_table TABLE (DBName VARCHAR(200), UserName VARCHAR(250), LoginType VARCHAR(500), AssociatedRole VARCHAR(200)) 
SET @DBuser_sql='
SELECT ''?'' AS DBName,a.name AS Name,
a.type_desc AS LoginType,
USER_NAME(b.role_principal_id) AS AssociatedRole 
FROM ?.sys.database_principals a 
LEFT OUTER JOIN ?.sys.database_role_members b ON a.principal_id=b.member_principal_id 
WHERE a.sid NOT IN (0x01,0x00) AND a.sid IS NOT NULL AND a.type NOT IN (''C'') 
AND a.is_fixed_role <> 1 AND a.name NOT LIKE ''##%'' AND 
''?'' NOT IN (''master'',''msdb'',''model'',''tempdb'') 
ORDER BY Name'
INSERT @DBuser_table 
EXEC sp_MSforeachdb @command1=@dbuser_sql 
SELECT * FROM @DBuser_table ORDER BY DBName 
--SELECT * FROM @DBuser_table where username='ABC' ORDER BY DBName 
Useful links
http://www.mssqltips.com/sqlservertip/2317/running-sql-server-agent-with-a-least-privilege-service-account/
http://www.brentozar.com/blitz/jobs-owned-by-user-accounts/
-Prashanth

Similar Messages

  • How can I find out the mail server from email address?

    Hi:
    How can I find out the mail server from email address?
    for example: If I know the email address is [email protected],
    how to find the pop3 and smtp mail server?
    THANK YOU

    You can't tell by the email address since you can pretty much put whatever you want in there (especially if the SMTP server is not filtering anything).
    The header may be able to tell you something. There is a Received header value which looks like it has the routing information although I am not sure if this is a complete trace or just the last hop the message took.
    Sean

  • How can I find out the number of pixels a photo has in i photo.

    How can I find out the number of pixels a photo has in iphoto.

    Do you mean in iPhoto on the MacBook Pro?
    The dimensions (width and height iin pixels)are shown in the "Info" panel - multiply the two numbers:
    Regards
    Léonie
    P.S: on an IOS device you see the same information in iPhoto, when you select the photo in an album and click th Info button ( i ).

  • How do i find out if the server admin daemon is running

    Hi All,
    I've got an OS X server that for some reason ( probably due to me pratting around) has decided not to have a working server admin prog. I can fire up the client program and point it at any of the IP addresses that the server is looking at and then you get an error message basically saying that the server admin daemon is not contactable.
    So ...
    1). How can i find out if the back end daemon is running
    2). what port(s) does it listen on
    3). How can I turn on some logging to see what's happening when I run serve admin
    4). Any other tips as to how to find out why its not working
    Rgds
    Alex

    You should post this in one of the forums in the Mac OS X Server v10.5 Leopard category. You'll get better response there.

  • How do i find out my DSN server ID?

    please help me....
    i am trying to run my xbox live.
    i have a comcast cable modem, where my connection is from.
    connect to another modem which i am using as a router.
    everything is working correctly , it says the cables are connected, the IP address is configured, but when it gets to the dsn server it stops... how do i configure my dsn server with my xbox?
    please help me!

    ericafromnewlondon wrote:
    Trying to setup airport express in a new office - do I need to have a static IP address?
    No.
    how do I find out what my DSN Server is, and DHCP client ID is?
    The DNS Server settings are normally provided by whatever router is "upstream" from the AirPort Express, presuming that the Express is configure to use DHCP.  What is the "upstream" device?  Will the AirPort Express connect to it wirelessly or by Ethernet?

  • How can we find out data in an editable ALV grid has been changed or not?

    Hi Experts,
    How can we find out whether a data in an editable ALV grid has been changed or not.
    I am using the
    FM -> REUSE_ALV_GRID_DISPLAY_LVC
    for ALV display.
    I have to chekc whther data has been changed or not befor saving. if changed then only i want to
    SAVE
    . I cannot use the internal table comparison method for this purpose also i am not using OOP ALV.
    So kindly sugest me an alternative.
    Thanks and Regards,
    Shahana

    Hi,
    Thanks for your answer. I already saw this post.
    See this method.
    CALL METHOD reuse_alv_grid->check_changed_data
    IMPORTING
    e_valid = lv_check.
    This will update the internal table with the edited values. Then we can go for internal table comparison.
    But my scenario will not allow me for itab comparisons.I just want to know the ALV data has been changed or not.
    Regards,
    Shahana

  • How do i find out what operating system my ipod touch has

    I just got a new iPod touch for Christmas and assumed it was using ios5.  But there is no icon for icloud anywhere on it and I can't find where it tells what its operating system is.  How do I find out what operating system my ipod touch is using?

    Go to Seting>General>About>Version
    However, there is no iCloud app.  There are various features the use iCloud.  If you go to Settings do yu see a settinging labled iCloud?

  • How can I find out if the rollback optimal parameter size has been set ?

    What is the command to find out if the rollback optimal parameter size has been set? And what is the command to find out what is the rollback optimal parameter set to?

    You can find the OPTIMAL size in v$rollstat.optsize

  • How to run Exe file through Sql server agent job

    Hello All
    i have 2 servers 
    1.Application Server
    2.Database server
    Application server has a .exe file so i wanted to run this exe file through SQL server agent job from database server.
    What is the process for run this Exe file 
    Can you plz suggest me step by step process
    Kamal

    While i'm trying to implement this below method
    Step1 : Right Click SQL Server Agent. Select New -> Job. This will open a wizard to schedule a new
    job.
    Step2 : Select Steps from options given on the left side of wizard. This is the main place to set your
    exe\program as a running step. Give some name to this step, Select Operating System (cmdexec) for the Type and give the full path of exe in Text box for Command.
    ex:\\10.11.00.98(your application serverIP)\ch.exe
    Thanks vanchan-Please
    mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers
    I got this below error
    Message
    Executed as user:NJROSJ345\SYSTEM. The process could not be created for step1 of job
    (Reason:Access is Denied)The step failed.
    But i have sys admin rights on the both the servers 
    Kamal

  • Help, how do i find out the host server for a website i have inherited

    hi i inherited responcibilty for a website, simply because
    there was noone else avalable. i have dreamweaver cs3, but only
    about 2 weeks worth of knowledge and experience. I was given info
    ie. ftp address and username etc, so have been able to download the
    website to my home computer, and have been making updates, now
    however i need to find out more about setting up a test server so i
    can use dynamic pages, specifically for collecting form
    information, collecting donations and selling art work. i will need
    some information from the host server to start with, but am unsure
    as how to identify and contact them, can anyone help me please. I
    am sure it is rudimentary, but the information is essential.
    also as a side note, could anyone tell me how to find out
    where the websites domain name is regestered ( other than
    contacting the original designer, as that seem quite impossible)
    because i get the feeling that if all else fails i may be able to
    move the website to another host ( not that i now how yet, or even
    how to select or find a host) please let me know if any of my
    assumptions are wrong.
    Thanking you in advance
    J
    volunteer.

    Hi,
    To find out about the host, go to register.com and look up
    the domain name.
    When it gives you results, it'll say that the name is already
    taken, but it
    will let you do a 'whois' on it.
    Those results can give you some info such as the server DNS.
    That may let
    you figure out the host.
    Sometimes the technical contact in the whois, is the host as
    well.
    "nsfwebnewbie" <[email protected]> wrote in
    message
    news:fmo8cf$3l5$[email protected]..
    > hi i inherited responcibilty for a website, simply
    because there was noone
    > else
    > avalable. i have dreamweaver cs3, but only about 2 weeks
    worth of
    > knowledge and
    > experience. I was given info ie. ftp address and
    username etc, so have
    > been
    > able to download the website to my home computer, and
    have been making
    > updates,
    > now however i need to find out more about setting up a
    test server so i
    > can use
    > dynamic pages, specifically for collecting form
    information, collecting
    > donations and selling art work. i will need some
    information from the host
    > server to start with, but am unsure as how to identify
    and contact them,
    > can
    > anyone help me please. I am sure it is rudimentary, but
    the information is
    > essential.
    > also as a side note, could anyone tell me how to find
    out where the
    > websites
    > domain name is regestered ( other than contacting the
    original designer,
    > as
    > that seem quite impossible) because i get the feeling
    that if all else
    > fails i
    > may be able to move the website to another host ( not
    that i now how yet,
    > or
    > even how to select or find a host) please let me know if
    any of my
    > assumptions
    > are wrong.
    >
    >
    > Thanking you in advance
    >
    > J
    > volunteer.
    >
    >

  • How do you find out the angle degree of type that has been rotated?

    I have manually rotated some type. It's not rotated a standard number of degrees and I'd like to find out what that number is. Do you know if there is a place in Illustrator that gives this informatiion because I sure as heck can't find it.

    You are supposed to be able to measure angles using the Measure Tool. I find this completely unreliable, because it fails to abide by Snaps. (Absolutely hideous.)
    This page describes an AI Javascript you can download and try, for un-rotating textframe objects.
    JET

  • How do you find out more about an App (needs login?, wi-fi?)

    Sometimes I purchase an app then find out that I can't use it without creating an account or that it needs an internet connection. Is there any way of knowing ahead of time which apps need what? I thought that, that would be a standard, but it isn't.

    The need for an account (for a particular App) or the need for a particular App to connect to the internet is dependent upon the App itself and the person who wrote it. Each App is written by "a bloke (or girl) in his or her bedroom", or an independent company, not by Apple.
    To determine whether an App requires either of these things, you need to research the App a bit more. In the App Store, each App should have a description (and you may need to click ther more button to see all of it) and also should have a "Support page" link. The support page should take you to the App developer's website, where I would hope to see all the information I need. But it isn't always like that.
    So it's down to you to understand what the App will do, what it needs in order for you to get the best from it and to do your own research to find all that out. There have been Apps I haven't bought because I haven't been able to get enough information about it. That's life, unfortunately.
    Phil

  • How do I find out if my TouchSmart 300-1210uk PC has Bluetooth?

    I'm trying to connect my new mobile which can only connect via Bluetooth but neither the PC or Mobile can find each other. I have the connectivity and visibiity turned on on the mobile but can't work out the PC. The word Bluetooth is written on the rear of my PC but there are no Bluetooth settings menu's that I can find under then control panel.
    This question was solved.
    View Solution.

    Hi,
    It does NOT have BT as in its specs down here:
      http://h20000.www2.hp.com/bizsupport/TechSupport/D​ocument.jsp?objectID=c02581529&lang=en&cc=us&taskI​...
    It only has this list:
    Interface type: PCI-e half-length mini card socket
    Data transfer speeds: up to 300 Mbps
    Transmission standards: 802.11 b/g/n
    Antennas: 2 (internal)
    Operating band: 2.4 GHz single band
    Supported security protocols:
    WPA-PSK
    WEP
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • How do I find out whether HP Pavilion p7-1110 PC has USB 2.0 or 3.0?

    Have to do a clean install of Win7 and need an external hard drive to use for file backups.  Have no idea where to find the USB info on my computer, and have had zero response when doing search.  Am a bit tech-challenged, but learning.   Help. 
    This question was solved.
    View Solution.

    You're very welcome.
    Glad to have been of assistance.

  • I belive somebody sent a virus to my iphone 4 how can i find out if my phone is infected and has a virus and what app are on my device also if there were any devices sent and removed from anthor phone

    my phone had 50% battery life and currently on the charger all of a sudden the phone powered completely off and will not power on or reboot I want to how i can look up what applications have been sent to my device

    iPhone do not get virus unless your iPhone is hacked/jailbroken.
    All 3rd parties apps run in a secured sandbox.
    iPhone battery if you haven't replaced it, is a few years old.
    You may need to re-calibrate the battery indicator.
    Charge to full using wall power adapter, play some graphic intensive game or similar till it switches off by itself, then charge it to full again.

Maybe you are looking for

  • Test print works but can't print from programs

    I have installed an Officejet 6500A. Install went as expected and drivers were loaded ok. I can print a test  page and the maintenance utilites will print fine but it will not print from any of the Windows programs. I am connected via USB. Any ideas

  • Free item on PO - accounting doc

    Hi, If we select the free item check box on the PO, while MIGO movement type 101, we would like to post to a different account than the regular GRIR account or Purchase price variance account. Has anyone come across this kind of requirement? If we do

  • PDF button not enabled in Print dialog box

    When I am in any application that allows printing and I select File > Print, the Print dialog box opens, but I can't select the PDF button (or the Preview button for that matter). I can see the buttons, but they are not selectable. I have a $HOME/Lib

  • What happened to the Sound Blaster Zeni

    It was supposed to be out in March but it is almost May. Was this card dropped?

  • Can't set up email account!

    When I purchased my Curve 3g about a year ago, I setup my email account like normal and it worked fine over this past year. Recently I had to change my email password on the computer, and it caused my blackberry to no longer be able to send or receiv