What is the effect of omitting size in nvarchar declaration

前端 未结 2 1359
灰色年华
灰色年华 2020-12-06 16:29

I usually define size when declaring parameters in my SP, like :

@myParam nvarchar(size)

or when I casting or converting:

C         


        
2条回答
  •  再見小時候
    2020-12-06 16:45

    It will set the size to the default size and truncate the rest. This will indeed likely come to bite you, unless the default size is appropriate.

    Event then, I would suggest you always specify the size to make it clear what you think the size will be, instead of having the next person that reads to code have to come to SO to ask what the default size of an nvarchar is ;).

提交回复
热议问题