Solved

Run command shell from trigger

Posted on 2004-10-25
855 Views
Last Modified: 2006-11-17
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
0
Question by:nickoarg
    3 Comments
     
    LVL 14

    Accepted Solution

    by:
    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
     
    LVL 3

    Author Comment

    by:nickoarg
    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
     
    LVL 14

    Expert Comment

    by:Jan_Franek
    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: From Zero to Hero with Nodejs & MongoDB

    Interested in Node.js, but don't know where to start or how to learn it properly? Confused about how the MEAN stack pieces of MongoDB, Expressjs, Angularjs, and Nodejs fit together? Or how it's even possible to run JavaScript outside of the browser?

    In today’s complex data management environments, it is not unusual for UNIX servers to be dedicated to a particular department, purpose, or database.  As a result, a SAS® data analyst often works with multiple servers, each with its own data storage…
    APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    884 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now