In general internal names in SQL Server are of datatype SYSNAME, which is
equivalent to NVARCHAR(128).
This is conformed for HOST_NAME() by:
SELECT SQL_VARIANT_PROPERTY(HOST_NAME(), 'BaseType') -- NVARCHAR
SELECT SQL_VARIANT_PROPERTY(HOST_NAME(), 'MaxLength') -- 256
MaxLength returns the length in bytes and so has to be divided by 2 to
arrive at the number of characters because it is a double-byte datatype.
--
Jacco Schalkwijk
SQL Server MVP
[quoted text, click to view] "Gary K" <GaryK@discussions.microsoft.com> wrote in message
news:CC69E5BF-1E27-410B-8705-18949A826B0F@microsoft.com...
> Sorry 2 bug, but I would like to know how long a variable should be to
> handle
> the maximum HOST_NAME length? All the documentation tells you is the
> datatype
> (nchar) and if you use this datatype you get a default length (usually 1).