sysname (as a data_type)

  • Hello everyone,

    I'm not sure what this data_type does:

    sysname

    Here's how it's used:

    DECLARE @Name sysname

    --

    Let me know what you guys think.

    Thanks,

    Himansu

  • From Book Online

    sysname data type is nvarchar(128), which allows for 128 Unicode characters.

    Expect different results as compared to earlier versions of SQL Server. Expect any columns or local variables defined as sysname to allow Unicode data. For more information about sysname, see Data Types.

     

    In older versions of sql server it was varchar(30).


    And then again, I might be wrong ...
    David Webb

  • Have you seen any use for this (besides for the system tables)?

  • The only other time I've seen this used is for tables created by vendors whose products reference the system tables.  I've never used it for anything.


    And then again, I might be wrong ...
    David Webb

  • I don't see why I would use that, it's just a custom datatype, nothing more.

  • In the case of this particular data type, using it, in the past would have caused you grief.  When the internal definition changed (I think it was in 7.0), then all the tables you would have used it in might have given you strange results (or ugly errors) unless you unloaded, redefined, and reloaded during your upgrade from earlier releases.

    I tend to not use custom data types unless there's some integrity reason to do so.  I'd rather be able to know what I'm dealing with in DDL without having to look up related stuff.  But then again, I'm old and set in my ways, and extrat steps tend to annoy me.  


    And then again, I might be wrong ...
    David Webb

  • I'm young and I agree .

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply