Options

Why the data type sysname is always in lower case?

ogrishmanogrishman Posts: 81 Bronze 4
edited November 18, 2016 5:18AM in SQL Prompt
I have the following code:
DECLARE
    @objectName sysname,
    @objectType CHAR(2);
SET @objectName = N'sysrscols';
SET @objectType = 's';
SELECT * FROM sys.objects WHERE [name] = @objectName AND [type] = @objectType;

I've already configured the keywords to use upper case. You can check my formatting style file here at: https://www.dropbox.com/s/uskhwtq0ecs0a ... ylev2?dl=1

The sysname keyword is always in lower case? Is this a bug?

Comments

  • Options
    Aaron LAaron L Posts: 596 New member
    Hi ogrishman,

    This is by design as sysname acts more like a user defined data type than a built-in data type and needs to be lower case for it to be recognised on case sensitive databases.

    (From https://technet.microsoft.com/en-us/lib ... 91240.aspx: Important: In databases that are case-sensitive, or that have a binary collation, sysname is recognized as a SQL Server system data type only when it appears in lowercase.)

    Thanks,
    Aaron.
Sign In or Register to comment.