• Chris Morris (4/22/2009)


    mithun.gite (4/22/2009)


    Dear friends,

    Need understanding, that y v can perform DMLs in Functions?

    We can use DMLs using table variable in fucntion then y can with actual tables..

    Please guide me thru..

    Mithun

    From BOL:

    The following statements are valid in a function:

    Assignment statements.

    Control-of-Flow statements except TRY...CATCH statements.

    DECLARE statements defining local data variables and local cursors.

    SELECT statements that contain select lists with expressions that assign values to local variables.

    Cursor operations referencing local cursors that are declared, opened, closed, and deallocated in the function. Only FETCH statements that assign values to local variables using the INTO clause are allowed; FETCH statements that return data to the client are not allowed.

    INSERT, UPDATE, and DELETE statements modifying local table variables.

    EXECUTE statements calling extended stored procedures.

    For more information, see Creating User-defined Functions (Database Engine).

    Can you explain what you are trying to do?

    thanks chris for ur reply...........

    after seeing ur reply i chekced my question which was bit wrong, which i corrected, actually i wan to know y we cant use DMLs in Functions?

    Sorry for the trouble.......

    And i m nothing trying but its been asked to me and i was clueless so i put it here..

    Mithun