سؤال

Is there any difference using one DECLARE statement for declaring all your variables in store procedure or function instead of using the statement for each one.

For example:

DECLARE @INST1 INT 
       ,@INST2 BIGINT
       ,@INST3 DATETIME
       .......
       ,@INSTN INT

and

DECLARE @INST1 INT
DECLARE @INST2 BIGINT
DECLARE @INST3 DATETIME
..................
DECLARE @INSTN INT

I am asking for differences like performance, reducing SQL server caches size and other internal for the server stuff, that I am not familiar with and can make the server job easier.

هل كانت مفيدة؟

المحلول

IHMO, there's no difference because the engine instantiate the same memory about variables in either cases. Is only a short ay to write code, but I prefer using a DECLARE for each variable because the code becomes read better

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top