varchar

How many characters in varchar(max)

How many characters can a SQL Server 2008 database field contain when the data type is VARCHAR(MAX)? Thanks guys, helped me out a lot :) ...

DB2 varchar index join

For DB2... table1.a is varchar(30) and has an index on it. table2.b is varchar(45) and has an index on it. Will table1.a = table2.b use the index on table1, table2, or both? Although it would seem obvious that it should use both indexes, I'm asking because I believe on sybase, this would only use one of the indexes (I'm not sure which...

Case ... When with strings in mysql

Hi I want to have some query like Select case column1 when column2 like '%Test%' then column 3 else 0 end FROM myTable in column2 there are varchars stored. Can someone help me with this? ...

#1071 - Specified key was too long; max key length is 767 bytes

When I executed the following command: ALTER TABLE `mytable` ADD UNIQUE ( `column1` , `column2` ); I got this error message: #1071 - Specified key was too long; max key length is 767 bytes Information about column1 and column2: column1 varchar(20) utf8_general_ci column2 varchar(500) utf8_general_ci I think varchar(20) only req...

char column converted to varchar still inserting padding

I don't really know how to explain this one. I've taken a table, created a copy of it with a specific column as varchar instead of char. Then I've copied the data from one table into the new one. However, when I then programmatically add a new value to the table, the column that was previously char(200) is still being padded with space u...

Boundless Stored Proceedure Input

I'm passing a comma delimited list of ids to a stored procedure as a varchar(MAX). The problem is varchar caps at 8000 characters and the list could potentially be larger. Is there a sql datatype where size doesn't matter? No pun intended. ...

Does index on Varchar make performance difference?

Does index on a varchar column make the query run slower? I can make that be int. and I don't need to do the LIKE % comparison. ...

Linq to SQL VarChar(Max) Update is not working

I am not able to get an update to work using Linq to SQL on a VarChar(Max) field. Here is the code I use that is called from a simple DAO class: public void UpdateContentById(int ContentId, string Content) { CkEditorDataContext db = new CkEditorDataContext(); CkEditorContent dbContent = db.CkEditorContents.First(c => c.CkeId == ...

MySQL VARCHAR Lengths and UTF-8

In MySQL, if I create a new VARCHAR(32) field in a UTF-8 table does it means I can store 32 bytes of data in that field or 32 chars (multi-byte)? ...

VARCHAR(x) - Does setting a length turn it into "fixed-length" in MySQL performance terms?

I understand the differences between CHAR and VARCHAR, one being fixed-length and the other variable-length, and that if all fields in a row are fixed-length, a table will generally perform better. However, something that is unclear to me is that if I give VARCHAR a length, such as VARCHAR(500), does this retain the row as fixed-length?...

What are real performance implications of using text instead of varchar types in MySQL?

Is there/has somebody any comparison, personal experience, or guideline when to use the text type instead of a large varchar in MySQL? While most of the entries in my database will be less than 1000 characters, some might take up to 4000 characters or more. What is the limiting length of varchar which makes text a better variant? I do ...

MySQL: Large VARCHAR vs. TEXT?

Apologies if this is a silly question, could use an opinion: I've got a messages table in MySQL which records messages between users. Apart from the typical ids and message types (all integer types) I need to save the actual message text as either VARCHAR or TEXT. I'm setting a front-end limit of 3000 characters which means the messages...

Is a varchar 2 more efficient than a varchar 255?

I'm using Django and setting my CharField(max_length=255), even though I only intend to use about 5 characters. Is this less efficient? I've read that it doesn't really matter with varchar but then read that it'll save hard drive space to specify only what you need. ...

Select by varchar column with IN() part in condition and int value returns all rows

Hello ! Can someone explain me why with that query: SELECT * FROM `tags` WHERE (tag IN ('willa-lentza', 2016)) it return me all rows from tags table, but when I put 2016 into quotes it works good ? tag column is varchar type. SAMPLE ENVIRONMENT CREATE TABLE `tags` ( `id` int(10) unsigned NOT NULL auto_increment, `tag` varchar...

Max size varchar(max) in SQL Server 2000

Hi all expert, I would like to know what is the maximum size of varchar in SQL Server 2000. While I was googling somewhere its written 8000 characters and somewhere its written 8060 bytes. which one is correct??? Pls confirm me.. Thanks, Kumar ...

MySQL - TEXT vs CHAR and VARCHAR

Reading this question a doubt poped into my head: char and varchar can store up to 255 chars text can store up to 65k chars char size in bytes is number of chars varchar size in bytes is number of chars used + 1 So how much bytes does TEXT actually occupies? ~65kb or number of chars used + 1? ...

varchar(max) everywhere?

Is there any problem with making all your Sql Server 2008 string columns varchar(max). My allowable string sizes are managed by the application. The database should just persist what I give it. Will I take a performance hit by declaring all string columns to be of type varchar(max) in Sql Server 2008, no matter what the size of the da...

Which MySQL datatype is more space efficient for scalable apps? TEXT or VARCHAR?

I'm building a highly scalable app, and I need to know which data type to use for small strings (50-1000 chars). I heard that VARCHAR is fixed sized and therefore might be faster, but with TEXT, chars might be stored in a seperate CLOB, and only a pointer in the row data. This would be smaller, but would it have any significant performa...

Possible consequences of increasing varchar length in MySql?

I'm using an old table, which has a varchar(40) field in it. I want it to be possible to insert more characters in that field, so I want to increase the length of it. Are there possible negative consequences I should think of before increasing the length? ...

SQL Server - Better Data type to store large string value

we have a database table which has around 200,000 records. which includes 3 ntext columns, which hold string data with length vary from 4000-70000. but a mere selection on the table takes more than 1 minute to return data. and even using where condition, and indexes to select 12000 records for a condition it takes 40 sec. so we decided...