Converting existing embedded SQL code into stored procedures;

  • plz i jus had it in my responsibilities could plz let me know how could we do that ..n what is embedded sql ...as i m new to sql server

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • Embedded SQLs are SQLs that are written directly in the application code. Usually a programmer will access the database using Stored Procs, but some of them writes the SQL code directly in the application.

    It is very difficult to find all the embedded SQLs. Basically because either you have to weed through the application code file by file or run a profiler an keep an eye on SQLs being executed.

    The bad thing about embedded SQL is that you have to give permission to the table directly to the user that is accessing it. If every call to the DB is Stored Procs then you need to give access only to the Stored Procs. This increases the security.

    I hope this helped.

    -Roy

  • Embedded SQL is SQL code in your application. So your code on the client does something like

    str="select * from MyTable where ID = " + strID

    You want to get this into a stored procedure in SQL Server.

    Create procedure MyProc

    @id int

    as

    select * from Mytable where ID = @id

    return

    Then call this in your code as a stored procedure, not an ad hoc query.

  • Steve has put it better than me..:-)

    -Roy

  • thkz a lot...

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

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

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