nnmmss
nnmmss

Reputation: 2974

Table Value function and commands inside of it

I have programmed a function with 1) Create Table in Tempdb

  1. Create Table in Tempdb
  2. Create Table Value
  3. while , If commands
  4. Delete values from Table
  5. Inserting values into above tables
  6. Checking existence of table

     IF OBJECT_ID('tempdb..#Results') IS NOT NULL 
     DROP TABLE #Results
    

inside of it. The results are in Temp tables show be backed

can I use a Table Value function for it? or it just should an insert

Upvotes: 1

Views: 34

Answers (1)

PSK
PSK

Reputation: 17943

can I use a Table Value function for it? or it just should an insert

No, DML functions are not allowed inside a function. You need to use a stored procedure to perform the operations you have mentioned.

Read following link for more details on what is allowed and not allowed in a function.

SQL SERVER – User Defined Functions (UDF) Limitations

Upvotes: 2

Related Questions