Monday, March 26, 2012

EXEC Command problem

Tried to do a search on EXEC and got a lot of hits, but none that I saw
addressed my problem.
I'm trying to move a DB, but when I type,
EXEC sp_detach_db 'database'
I get the unrecognized command error.
I did a search for EXEC, but couldn't find it.
Any suggestions/assistance?
Thanks.
hi,
"BobCo" <BobCo@.discussions.microsoft.com> ha scritto nel messaggio
news:3B1E774A-0376-4CE3-B7D3-6BF054155724@.microsoft.com
> Tried to do a search on EXEC and got a lot of hits, but none that I
> saw addressed my problem.
> I'm trying to move a DB, but when I type,
> EXEC sp_detach_db 'database'
> I get the unrecognized command error.
> I did a search for EXEC, but couldn't find it.
> Any suggestions/assistance?
> Thanks.
EXEC is just execute the stored procedure (the system stored procedure, in
this case), and is required when the call to stored procedure is not the
very first line of the current Transact-SQL batch
so the problem is not EXEC ...
actually you usually should get
Server: Msg 229, Level 14, State 5, Procedure sp_detach_db, Line 50
EXECUTE permission denied on object 'sp_detach_db', database 'master', owner
'dbo'.
if your current user has not been granted membership to sysadmins server
fixed role, as only relative members are allowed to execute that system
stored procedure... further details at
http://msdn.microsoft.com/library/de...da-di_83fm.asp
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.9.1 - DbaMgr ver 0.55.1
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
|||Hi ,
The Exec command is just optional and the call to the stored procedure
sp_detach_db command completes even if the exec prefix is ommitted.
Also you can also try using the Enterprise manager to do the same task.
Girish Sundaram
This posting is provided "AS IS" with no warranties, and confers no rights.
|||hi Girish,
"Girish Sundaram" <girishs@.microsoft.com> ha scritto nel messaggio
news:MjgS8Dl7EHA.2600@.cpmsftngxa10.phx.gbl
> Hi ,
> The Exec command is just optional and the call to the stored procedure
> sp_detach_db command completes even if the exec prefix is ommitted.
> Also you can also try using the Enterprise manager to do the same
> task.
> Girish Sundaram
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
actually you can't... AFAIK, EM is not allowed to be used in conjunction
with MSDE instances..
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.9.1 - DbaMgr ver 0.55.1
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply

No comments:

Post a Comment