Все вопросы: [varchar]
61 вопросов
Что означает varchar (-1)?
Что означает varchar (-1) в SQL Server 2008?Это альтернатива varchar (max)?
Должен ли я использовать встроенный столбец varchar (max) или хранить его в отдельной таблице?
Я хочу создать таблицу в MS SQL Server 2005 для записи деталей определенных системных операций.Как видно из дизайна таблицы ниже, каждый столбец, кроме Details, не допускает значения NULL. CREATE TABLE [Log] ( [LogID] [int] IDENTITY(1,1) NOT NULL, [ActionID] [int] NOT NULL, [SystemID] [int] N...
Как узнать, что мой сервер PostgreSQL использует локаль "C"?
Я пытаюсь оптимизировать свои таблицы БД PostgreSQL 8.3 в меру своих возможностей, и я не уверен, нужно ли мне использовать varchar_pattern_ops для определенных столбцов, где я выполняю LIKE для первых N символов строки.Согласно этой документации , необходимо использовать только xxx_pattern_ops...
MySQL VARCHAR size limit
If I have a column in table with field of type VARCHAR(15) and if I try to insert data of length 16, MySQL gives an error stating Data too long for column 'testname' at row 1 Does anyone know why VARCHAR fields in MySQL take fixed length? Also how many bytes does a VARCHAR field take per recor...
Why are SQL fields lengths always (2^n)-1 unless less than 127?
A lot of Database schemas seem to follow the following standard: (2^n)-1 for large fields: varchar(511) varchar(255) varchar(127) ...then (2^n) for smaller ones varchar(64) varchar(32) varchar(16) varchar(8) I understand why numbers of (2^n)-1 are used, what I don't understand is why it is...
mysql 7columns pk vs. 1 column md5 unique constraint
i have a very large table which is currently approx 70M rows and growing daily by the thousands , this schema is tipping over every day now so i'm moving to a partitioned table and redesigning the ddl . the table is basicly a collection of NOT NULL INTEGERS(some medium some INT some tiny) which ...
Nvarchar or varchar what is better use multiply of 2 or rounded full numbers?
My question is what is better to use in generating columns in SQL. Should the size of nvarchar (varchar) be multiply of 2 (32, 64, 128) or it's doesn't matter and we can use fully numbers example '100', '50' ? Thank You very much for answers with reasons Greeting's to all
nextval sequence for varchar in sql?
I was wondering if there was a way of making a nextval sequence for a varchar value? I am using iSQL plus, oracle. For e.g. I have a sales table which consists of sale_id, prod_id, cust_name, sale_name. where I insert the data by doing the following: insert into sales select sale_id_seq.nextval,...
Mapping to varchar and nvarchar in hibernate
If there are 2 columns in database, eg. code varchar(3) name nvarchar(50) How to tell hibernate to pass varchar for searching by code? In the hibernate mappings string is mapped to nvarchar and it produces queries like: Select code, name From table where code=N'AAA' (instead of code='AAA') ...
Is a VARCHAR(20000) valid in MySQL?
I’m in need of some clarification of the maximum length of a varchar field in MySQL. I’ve always thought the max length was 255 (255 what? Characters I’ve assumed, but this might be a source of my confusion). Taking a look at the tables of a database set up by an external company we’re working w...
How long should SQL email fields be?
I recognize that an email address can basically be indefinitely long so any size I impose on my varchar email address field is going to be arbitrary. However, I was wondering what the "standard" is? How long do you guys make it? (same question for Name field...) update: Apparently the max length...
MySQL table with only a varchar as a foreign key
I have a table with a single unique VARCHAR(512) field. I want to have another table hold a foreign key reference to this first table. Both tables use InnoDB. If I add a VARCHAR(512) key to the second table and add a foreign key constraint on it will the 512 bytes long data be held twice? If so,...
Determine varchar content in nvarchar columns
I have a bunch of NVARCHAR columns which I suspect contain perfectly storable data in VARCHAR columns. However I can't just go and change the columns' type into VARCHAR and hope for the best, I need to do some sort of check. I want to do the conversion because the data is static (it won't change...
[My]SQL VARCHAR Size and Null-Termination
Disclaimer: I'm very new to SQL and databases in general. I need to create a field that will store a maximum of 32 characters of text data. Does "VARCHAR(32)" mean that I have exactly 32 characters for my data? Do I need to reserve an extra character for null-termination? I conducted a simple...
MySQL: Why use VARCHAR(20) instead of VARCHAR(255)?
Possible Duplicate: Are there disadvantages to using a generic varchar(255) for all text-based fields? In MYSQL you can choose a length for the VARCHAR field type. Possible values are 1-255. But what are its advantages if you use VARCHAR(255) that is the maximum instead of VARCHAR(20)...
What size to pick for a (n)varchar column?
In a slightly heated discussion on TDWTF a question arose about the size of varchar columns in a DB. For example, take a field that contains the name of a person (just name, no surname). It's quite easy to see that it will not be very long. Most people have names with less than 10 characters, an...
VARCHARS: 2, 4, 8, 16, etc.? Or 1, 3, 7, 15, etc.?
I see VARCHAR(255) being used all the time instead of VARCHAR(256), but I also see VARCHAR(16) being used instead of VARCHAR(15). This seems inconsistent to me. If an extra byte is being used to store the VARCHAR's length, shouldn't this rule also apply to the smaller lengths like 2, 4, 8 to be 1...
Is there a good reason I see VARCHAR(255) used so often (as opposed to another length)?
In multiple courses, books, and jobs, I have seen text fields defined as VARCHAR(255) as kind of the default for "shortish" text. Is there any good reason that a length of 255 is chosen so often, other than being a nice round number? Is it a holdout from some time in the past when there was a g...
What is the difference between CHARACTER VARYING and VARCHAR in PostgreSQL?
John uses CHARACTER VARYING in the places where I use VARCHAR. I am a beginner, while he is an expert. This suggests me that there is something which I do not know. What is the difference between CHARACTER VARYING and VARCHAR in PostgreSQL?
oracle varchar to number
How do i convert a oracle varchar value to number eg table - exception exception_value 555 where exception_value is a varchar type I would like to test the value of exception_value column select * from exception where exception_value = 105 instead of select * from exception where exception_...
What are the optimum varchar sizes for MySQL?
How does MySQL store a varchar field? Can I assume that the following pattern represents sensible storage sizes : 1,2,4,8,16,32,64,128,255 (max) A clarification via example. Lets say I have a varchar field of 20 characters. Does MySQL when creating this field, basically reserve space for 32 byt...
Как Hibernate может сопоставить тип данных SQL nvarchar (max)?
У меня есть столбец в моей базе данных SQL-2005, который раньше был varchar(max) , но теперь он был изменен на nvarchar (макс.) . Теперь мне нужно обновить файл сопоставления гибернации, чтобы отразить изменения, и это то, что было раньше: Когда я пытаюсь запустить приложение, п...
Ошибка создания таблицы в MySQL 4.1
Столбец, который определен с типом char в предложении создания таблицы, определяется как varchar () Он был определен как преобразование char (8) в varchar (8) в описании БД. char (1) -> char (1) в той же БД Когда он определил таблицу типа char более 2 байтов для преобразования для varchar ...
Сжатие SQL 2008
Я стажер, и меня попросили провести исследование по сжатию данных в SQL 2008. Мы хотим хранить несколько частей электронных писем Outlook в таблице. Проблема в том, что мы хотим сохранить все тело письма в поле, но затем хотим его сжать. Использование Char () не сохранит все тело, но разрешит сж...
Недостаток большого LIMIT типов VAR
Есть ли какой-либо недостаток (за исключением того, что значение или массив слишком велик) в установке максимального целочисленного размера VARCHAR или VARRAY на значение, значительно превышающее фактически необходимое (или установление его на максимально допустимый размер)?
Что быстрее для таблицы innodb в MySQL: varchar (255) или tinytext?
Я оптимизирую некоторые таблицы innodb в MySQL, поэтому я запустил процедуру analsye () , чтобы узнать, какие были рекомендации. В результатах рекомендуется использовать tinytext вместо varchar (255) для всех полей, которые ранее были настроены как varchar (255) Можно ли получить при...
Влияет ли объявленный размер поля varchar на PostgreSQL?
Чем VARCHAR (100) лучше, чем VARCHAR (500) с точки зрения производительности? А как насчет использования диска? Говоря о PostgreSQL сегодня, а не о какой-то базе данных в истории.
Оценка размера текста в MySQL
Когда у меня есть текстовое поле, я обычно сохраняю его как varchar. Но затем я сталкиваюсь с вопросом, как узнать, какой предел я должен установить? Оценка того, сколько текста наберет пользователь, кажется очень неточной. Поскольку varchar использует столько места, сколько необходимо, не лу...
Урезать VARCHAR до определенной длины в Derby АВТОМАТИЧЕСКИ
Как я могу АВТОМАТИЧЕСКИ усечь VARCHAR до длины поля таблицы в Derby с помощью SQL? Чтобы быть конкретным: CREATE TABLE A ( B VARCHAR(2) ); INSERT INTO A B VALUES ('1234'); вызовет SQLException: A truncation error was encountered trying to shrink VARCHAR '123' to length 2. Есть ...
Какова длина строки GUID?
Я хочу создать столбец varchar в SQL, который должен содержать N'guid', а guid - это GUID, сгенерированный .NET ( Guid.NewGuid ) - класс System.Guid. Какую длину varchar следует ожидать от GUID? Это статическая длина? Следует ли мне использовать nvarchar (будет ли GUID когда-либо использов...