5
Answers

Why can not use temp table in function?

Photo of Pankaj Kumar

Pankaj Kumar

8y
992
1
Why can not use temp table in user define function in sql server?

Answers (5)

1
Photo of Pankaj Kumar
NA 143 30.1k 7y
Hi Jasbeer Singh
 
I know User defined functions have no access to structural and Permanent Tables.but why?
1
Photo of Subhashkumar Yadav
693 1.3k 60.9k 8y
You can not use temp table in user define function.
1
Photo of Jasbeer Singh
NA 7.1k 555.4k 8y
Hi Pankaj,
 
You can't use temp table in UDF. User defined functions have no access to structural and Permanent Tables. You can use table variables instead of Temp tables and they will give you same result.
 
Please mark as answer if it solves or clears your confusion.
 
Regards
Jasbeer Singh
0
Photo of Manish Kumar
NA 1.4k 8.8k 7y
Well good question u have asked, WHY... 
please check below link...
 
 
https://ask.sqlservercentral.com/questions/90201/table-variables-in-user-defined-functions.html 
0
Photo of Daniel Jones
NA 317 74.8k 8y
you can use a table variable in your proc and pass it as a table-valued-parameter to the function