|
how to use ddl statements in functions and is there any limitation to use ddl statements,means we can use some no of ddl statements. plaese tell me in procedure also.help me to get out this question ..
(comments are locked)
|
|
Is the question then, can you use DDL statements within user defined functions? If so, the answer is no. You can't use DDL statements within UDFs. From the books online, these are the valid types of statements: 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. The rule of thumb is that a function should have no effect on the state of the database (except possibly temporary read locks of course) and only return data. DDL statements by definition are designed to change the state of the database.
Mar 03 '10 at 04:00 PM
TimothyAWiseman
(comments are locked)
|
(comments are locked)
|

