So for really long object names that are 128 characters in length, the value would be 128 + 2 = 130 characters. The brackets will add two more characters to the value. Set = quotename(object_name(object_id)) The Issue This handles those cases where there are special characters in the name or the name is a reserved keyword.Įxample – set = quotename(db_name(db_id())) SQL Server object names can be at most 128 characters long, so common wisdom is to declare the holding variable or column as SYSNAME data type or one of the alphanumeric datatype with a width of 128 characters.Īnother technically correct thing to do is to use the QUOTENAME function to wrap the object name in brackets. database name, table name, index name etc. Some index maintenance scripts or dynamic SQL scripts use SQL object names as values for variables or columns i.e.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |