2

Is the most correct spelling for int upper case INT or lower case int?

There are many other reserved words in SQL Server.

How to find out the best case for each word?

For example the picture below is a random piece of code, with many different words in it, how can I verify that those words have the, so to say, 'right' case spelling?

Would these things matter in case I have a CS (case sensitive) database?
Would any interfere in the performance?

Let's say select 1 from table1 where 1=1 and SELECT 1 FROM table1 WHERE 1=1?

enter image description here

How to Convert Data to Proper Case In SQL Server

0

1 Answer 1

5

So,

Writing it as an answer for anyone else who might need this in the future-the answer to this question is described very nicely in the Why I use lower case for data type names (now) blog post from Aaron Bertrand.

As he explains in his blog post, this is important when using different database collations from the default one, for example (from the blog):

Considering this database:

CREATE DATABASE floobmort COLLATE Latin1_General_BIN2; 
GO
USE floobmort;

The following query will provide an empty result set because "That comparison tries to compare N'INT' to what's stored in the table, N'int', and because the comparison is done using a binary collation, it returns false."

SELECT system_type_id 
FROM sys.types 
WHERE [name] IN (N'INT', N'VARCHAR');

Not the answer you're looking for? Browse other questions tagged or ask your own question.