Equivalent of varchar(max) in MySQL?

The max length of a varchar is subject to the max row size in MySQL, which is 64KB (not counting BLOBs): VARCHAR(65535) However, note that the limit is lower if you use a multi-byte character set: VARCHAR(21844) CHARACTER SET utf8 Here are some examples: The maximum row size is 65535, but a varchar also includes … Read more

Changing the maximum length of a varchar column?

You need ALTER TABLE YourTable ALTER COLUMN YourColumn <<new_datatype>> [NULL | NOT NULL] But remember to specify NOT NULL explicitly if desired. ALTER TABLE YourTable ALTER COLUMN YourColumn VARCHAR (500) NOT NULL; If you leave it unspecified as below… ALTER TABLE YourTable ALTER COLUMN YourColumn VARCHAR (500); Then the column will default to allowing nulls … Read more

What are the main performance differences between varchar and nvarchar SQL Server data types?

Disk space is not the issue… but memory and performance will be. Double the page reads, double index size, strange LIKE and = constant behaviour etc Do you need to store Chinese etc script? Yes or no… And from MS BOL “Storage and Performance Effects of Unicode” Edit: Recent SO question highlighting how bad nvarchar … Read more

What is the string length of a GUID?

It depends on how you format the Guid: Guid.NewGuid().ToString() = 36 characters (Hyphenated) outputs: 12345678-1234-1234-1234-123456789abc Guid.NewGuid().ToString(“D”) = 36 characters (Hyphenated, same as ToString()) outputs: 12345678-1234-1234-1234-123456789abc Guid.NewGuid().ToString(“N”) = 32 characters (Digits only) outputs: 12345678123412341234123456789abc Guid.NewGuid().ToString(“B”) = 38 characters (Braces) outputs: {12345678-1234-1234-1234-123456789abc} Guid.NewGuid().ToString(“P”) = 38 characters (Parentheses) outputs: (12345678-1234-1234-1234-123456789abc) Guid.NewGuid().ToString(“X”) = 68 characters (Hexadecimal) outputs: {0x12345678,0x1234,0x1234,{0x12,0x34,0x12,0x34,0x56,0x78,0x9a,0xbc}}

What is the difference between char, nchar, varchar, and nvarchar in SQL Server?

Just to clear up… or sum up… nchar and nvarchar can store Unicode characters. char and varchar cannot store Unicode characters. char and nchar are fixed-length which will reserve storage space for number of characters you specify even if you don’t use up all that space. varchar and nvarchar are variable-length which will only use … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)