varchar
How do I know if my PostgreSQL server is using the “C” locale?
Currently some locale [docs] support can only be set at initdb time, but I think the one relevant to _pattern_ops can be modified via SET at runtime, LC_COLLATE. To see the set values you can use the SHOW command. For example: SHOW LC_COLLATE _pattern_ops indexes are useful in columns that use pattern matching constructs, like … Read more
Select truncated string from Postgres
The n in varchar(n) is the number of characters, not bytes. The manual: SQL defines two primary character types: character varying(n) and character(n), where n is a positive integer. Both of these types can store strings up to n characters (not bytes) in length. Bold emphasis mine. Use left() to “truncate” a string to a … Read more
oracle varchar to number
You have to use the TO_NUMBER function: select * from exception where exception_value = to_number(‘105’)
MySQL – Select only numeric values from varchar column
SELECT * FROM mixedvalues WHERE value REGEXP ‘^[0-9]+$’;
Are there disadvantages to using VARCHAR(MAX) in a table?
Sounds to me like you plan to use the varchar(MAX) data type for its intended purpose. When data in a MAX data type exceeds 8 KB, an over-flow page is used. SQL Server 2005 automatically assigns an over-flow indicator to the page and knows how to manipulate data rows the same way it manipulates other … Read more
MySQL – TEXT vs CHAR and VARCHAR
TEXT is a variable length datatype, with a maximum of 65,000 characters. LONGTEXT can be used for over 4 trillion characters. To answer your question: it’s a variable lenght, and it will only occupy the amount of characters you store.
Prevent empty strings in CHARACTER VARYING field
Use a check constraint: CREATE TABLE foobar( x TEXT NOT NULL UNIQUE, CHECK (x <> ”) ); INSERT INTO foobar(x) VALUES(”);
MySQL: Why use VARCHAR(20) instead of VARCHAR(255)? [duplicate]
Check out: Reference for Varchar In short there isn’t much difference unless you go over the size of 255 in your VARCHAR which will require another byte for the length prefix. The length indicates more of a constraint on the data stored in the column than anything else. This inherently constrains the MAXIMUM storage size … Read more
Migrating Varchar to Text in Mysql
ALTER TABLE table_name MODIFY column_name TEXT NOT NULL;