Writing Extended Stored Procedures

  • Morning Guys,

    So i'm not so sure this is specifically a Administration related question or Development, possibly both.

    I have some routines I have written in C# that perform particular system functions, like shutting down a server, performing basic ftp functions, you get the idea.

    I want to now load these into SQL Server as extended stored procs? But havent got a clue how to? and cant find anything on the web that specifies what my .dll should look like? (I'm assuming its a .dll I need), how I load it up on SQL Server or how SQL Server will manage its execution?

    Does anybody have any links, suggestions to help with this, perhaps a book ISBN

    Even an 'hello, world' example would be cherished.

    Thanks in advance,

    Alex Wilson

  • Don't know if you have been here but BOL has this in the index

    extended stored procedures, adding

     



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • You can use SQL DTS to shutdown the Server and SQLDTS FTP to FTP files. 

    Use WMI Class Win32_OperatingSystem in the DTS Package to reboot the Server.

  • Hiya AngPeng, I dont suppose you have some source code to shutdown via DTS do you?

    Or a link to a site with some good WMI examples, please.

     -- Alex

     

  • Add this script to your Activex script task to reboot the Server.

    'To reboot the local machine

     strComputer = "."

    'To reboot other Machine

    ' strComputer = "10.231..."  or Machine name

    Set objWMIService = GetObject("winmgmts:" _

    & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")

    Set colOperatingSystems = objWMIService.ExecQuery _

    ("Select * from Win32_OperatingSystem")

    For Each objOperatingSystem in colOperatingSystems

     ObjOperatingSystem.Reboot()

    Next

  • hiya again,

    thanks so much for the code..

    one last thing, can you recommend any good books/sites for WMI querying, as I clearly do not know enough about it. (or anything at all, in fact!)

    cheers,

    Alex

     

  • one last thing, can you recommend any good books/sites for WMI querying, as I clearly do not know enough about it. (or anything at all, in fact!)

    Maybe this will help: http://www.microsoft.com/technet/community/scriptcenter/user/default.mspx

     

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply