Showing posts with label located. Show all posts
Showing posts with label located. Show all posts

Thursday, March 29, 2012

Credentials and extended stored procedures

I have a database script that uses the extended stored procedures sp_OACreate and sp_OCMethod to execute an .exe file. The .exe file is located on the same machine as the SQL Server. At this time it does nothing but log the name of the user calling it.

When I execute the script from Management Studio (logged in as myself) the user being logged as the caller of the .exe is still NT AUTHORITY\SYSTEM. I don't know why NT AUTHORITY\SYSTEM is the caller, cause the SQL Server service runs under another domain account.

I have tried playing around with EXECUTE AS USER but no matter what, the caller of the .exe is always logged as NT AUTHORITY\SYSTEM.

Are there any way I can pass my credentials to the executable that I am calling from the T-SQL script?

Have you given the NT AUTHORITY/SYSTEM privileges on SQL Server?|||

No, not intentionally. It is a default SQL server installation.

I switched the user that runs the SQL service to a domain user (it was local system account before), and that is basically all that has been changed, apart from giving some domain users access to some databases on the server.

Tuesday, March 27, 2012

Creating view on another database

Hi I have two SQL server 2000 machine in my corporate

How to create a SQL View if the database table is located on another SQL server?

Example :
I am currently working at SQL Server "S01", but need to create a sql view to table customer on "Marketing" database located on SQL Server "S02"

if the table is reside on the same machine then it's simple for me, but this customer table is not located on "S01" but located on different machine "S02"

how to do this? any tutorial?

thanks a lot

YonscunThe way to make that easy is to right click at the top of Enterprise Manager and register the other server so it becomes local to you. So you just choose the server in the drop down list in Query Analyzer. Hope this helps.|||First make a linked server to S02 from S01 (make sure username and password is correct)

then right click in view, choose new view.

put this code :

select *
from S02.Marketing.dbo.Customer

done!