I would like to get confirmation on the maximum length of a fully qualified SQL Server object name.
Please vote on the answer below if you agree. (I won't get points for these votes)
Currently I worked out the following:
nvarchar<Server>.<Database>.<Schema>.<Object>sysname = nvarchar(128))quotename() of a 128 character string is maximum (128*2)+2 (each character escaped + open and close square brackets).This makes (((128*2)+2)*4)+3 = 1035
From that I derive the formula: (((128*2)+2)*@nr_of_name_parts)+(@nr_of_name_parts-1)
I think the formula is correct because plugging in 3 parts ends up with 776 which happens to be the param length of the sp_recompile procedure
(Answering my on question as community wiki, based on the comment of Mikael Eriksson)
<Server>.<Database>.<Schema>.<Object>nvarchar(128))quotename() of a 128 character string is maximum (128*2)+2 (each character escaped + open and close square brackets).This makes (((128*2)+2)*4)+3 = 1035
From that I derive the formula: (((128*2)+2)*@nr_of_name_parts)+(@nr_of_name_parts-1)
I think the formula is correct because plugging in 3 parts ends up with 776 which happens to be the param length of the sp_recompile procedure
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With