Should ID be stored as int or string?
5 Answers. You are doing the right thing – identity field should be numeric and not string based, both for space saving and for performance reasons (matching keys on strings is slower than matching on integers).
Can a number be stored as a string?
One of the most widely used data types is a string. A string consists of one or more characters, which can include letters, numbers, and other types of characters.
What are strings and integers?
Integer is a numeric value, while String is a character value represented in quotes.
Is there a variable to hold list of integers?
You are right, there is no datatype in SQL-Server which can hold a list of integers. But what you can do is store a list of integers as a string. You can then split the string into separate integer values and put them into a table. Your procedure might already do this.
When to use an alphanumerical ID instead of a numerical ID?
Using alphanumerical ID’s rather than numerical means you need fewer characters to express an ID of the same bit-size. For example 6 digits give you a million unique id’s but 6 alphanumeric characters (using the base64 set) gives you 68 billion unique identifiers.
When do you use a long, string ID instead of?
On the non-sequential nature of the IDs: it means they don’t need a synchronized counter between all the servers that assign IDs to videos. They can just generate a random number, check if it’s already in use, and go from there. They could even assign each server a block of IDs to pick from and eliminate the duplication checking.
When do you use a string instead of a number?
Better UTF-8 space – when you turn a number into a string you get at most 10 combinations per character (0-9), but when you allow any alpha numberic characters you get 62 combinations per character (a-z, A-Z, 0-9), so by using alphanumeric strings you can produce shorter urls than if you used numeric strings.