Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 can not execute

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2012-01-06 : 12:11:44
Hi,
Running a sql statement under a specific windows account...
On one server my sql executes fine but on another it gives the following error:
Cannot execute as the server principal because the principal "DomainName\AccountName" does not exist, this type of principal cannot be impersonated, or you do not have permission.
The sql query I run is xp_cmdshell @param
Thanks

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2012-01-06 : 12:33:27
I don't see a question anywhere.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-06 : 13:30:26
quote:
Originally posted by arkiboys

Hi,
Running a sql statement under a specific windows account...
On one server my sql executes fine but on another it gives the following error:
Cannot execute as the server principal because the principal "DomainName\AccountName" does not exist, this type of principal cannot be impersonated, or you do not have permission.
Thanks


Is the server also under same domain?
have you added the account as a valid login inside?
The error clearly suggests it cant find a login inside db

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2012-01-08 : 10:33:49
quote:
Originally posted by visakh16

quote:
Originally posted by arkiboys

Hi,
Running a sql statement under a specific windows account...
On one server my sql executes fine but on another it gives the following error:
Cannot execute as the server principal because the principal "DomainName\AccountName" does not exist, this type of principal cannot be impersonated, or you do not have permission.
Thanks


Is the server also under same domain?
have you added the account as a valid login inside?
The error clearly suggests it cant find a login inside db

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/




YES.
The account I am using to login is a windows account and not a sql login account.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-08 : 10:45:00
wats the sql statement you're trying to run?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2012-01-09 : 02:35:27
Have you sourrounded with it by square braces in your code?

[DomainName\AccountName]

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2012-01-09 : 03:09:32
quote:
Originally posted by madhivanan

Have you sourrounded with it by square braces in your code?

[DomainName\AccountName]

Madhivanan

Failing to plan is Planning to fail


Do you mean like:
xp_cmdshell @param, [DomainName\AccountName], @pwd
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2012-01-09 : 03:10:18
quote:
Originally posted by visakh16

wats the sql statement you're trying to run?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/




It is mentioned in the first post.
Thanks
Go to Top of Page
   

- Advertisement -