.NET class call from SQL2K Stored Procedure

  • Question:

    I am trying to figure out if it is possible to call a .NET class from a stored procedure running on SQL server 2000?

    Here is what I am doing:  I have a web application that requires an authentication code which is an encrypted string produced by this above mentioned class.  This string is sent out to the user via email and is then used via the querystring by the app. The app decrypts the string to make sure it is a valid code and then grants or denies access to the application.   I would like to be able to fire a SP ON INSERT that would generate the code and update the inserted record. 

    The only other way I have resolved this task is by doing the generation of the codes outside of SQL server on a nightly basis which denies real time access for users just added to the table.

     

  • This was removed by the editor as SPAM

  • It is not entirely clear to me what you are trying to achieve...

    I would store the encrypted password in the database (unless you need it for something else, of course). Just pass in the encrypted string and work with that. There even is no need to decrypt the password in your application.

    You won't have to worry about security issues in the database (well, you DO have to worry, obviously, but if your database is attacked, it becomes a bit more difficult to get to the (original) password).

  • Ooooh, and to answer your question

    Don't think it is possible to call a class directly (not from SQL2000 anyway). Yukon promises this, if I'm not mistaken...

    Anyway, you have two options :

    1. Use xp_cmdshell to start a small app that does what you need with the .NET class

    2. Start a DTS job with some scripting to call your .NET class.

    Both of these should be avoided, just have a look at the article from Steve Jones : http://qa.sqlservercentral.com/columnists/sjones/worstpracticetriggeringexternalevents.asp

  • And there is one more way..

    CREATE a CCW of your class and try to use the sp_OA* procedures but all those alternatives seem too cumbersome as  NPeeters  said previously a better approach would be to use sql for storage not for code

     


    * Noel

Viewing 5 posts - 1 through 4 (of 4 total)

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