Run command shell from trigger

Hi, I need to create a trigger that would run a shell command. How can this be done, if possible? I'd need the statement or where to get some detailed documentation. Is this common for all databases? ie Sybase, Oracle, MySQL, SQL... and so on... meaning, is it SQL standard or it depends on the database / Operating system.
Thanks
LVL 3
nickoargAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Jan FranekConnect With a Mentor Commented:
It surely depends on database system. In Sybase and MS SQL you can use xp_cmdshell extended stored procedure to execute any shell command from sql, so you can use it in trigger as well. I don't know, if it's possible in other database systems.
0
 
nickoargAuthor Commented:
are there limitations on the commands you can execute? obviously depending on the platform, but anything else? do the databeses always support xp_cmdshell by default? or is it an added "library" or so...
Thanks
0
 
Jan FranekCommented:
Well, speaking of Sybase and MS SQL implementation:

In fact, extended stored procedures are executed by XP server not database server. But XP server is part of usual instalation and it is installed by default, so you don't need anything special to use it.

It runs on all platform that database runs on (MS SQL only on Windows, Sybase ASE on Windows, Linux, Solaris, AIX, HP-UX...).

There are some security related limitations - on Sybase (and probably on MS SQL as well) you can choose, what user context will the shell run in - it can be context of logged in user (there must exist OS user with the same login name) or context of user, that run database server.
0
All Courses

From novice to tech pro — start learning today.