I recently joined one of the projects on my team. They use ASP.NET MVC and MS SQL together with the Entity Framework as ORM.
I noticed that each of the stored procedures used in EF has this common line at the beginning of the stored procedure definition
IF(0=1) SET FMTONLY OFF
I thought this was a very strange condition, so I worked on it a bit and also asked my colleagues about it. They say that when EF displays the stored procedure, it sends all parameters as null and skips the entire if loop. Therefore, he would also skip the condition IF(0=1)and thenSET FMTONLY OFF
When searching for SET FMTONLY OFFMSDN, says
Returns only metadata to the client. It can be used to check the response format without actually executing the request.
This becomes a problem when you do not control the database, you must constantly inform the database administrator about its addition and explain to them again and again why this is necessary in the first place.
I still don't have a clear idea of why this is required. If someone can explain this in a little detail or direct me to some link that covers this topic, that would mean peace to me.
source
share