Questions tagged [tinyint]

tinyint is one of the Exact number data types that use integer data.

Integer data from 0 through 255. Storage size is 1 byte.

Type    Storage     Minimum Value   Maximum Value
        (Bytes)   (Signed/Unsigned) (Signed/Unsigned)

TINYINT   1          -128             127

Reference

101 questions
1
vote
2 answers

MySQL index on TINYINT column: why is there a difference between checking '= 0' and checking 'is false'?

MySQL is providing different execution plans for a query depending on whether I check that an indexed TINYINT field 'is false' or '= 0'. The table's name is ordini (means 'shipments') and the index that I want MySQL to use is…
javier
  • 62
  • 7
1
vote
1 answer

Converting text to tinyint in MYSQL

By now, I understood there is no BOOLEAN type in mysql and internally it converts to tinyint(1) when the datatype is boolean. But I also came across that tinyint is not being handled by CAST or CONVERT function. So basically my question is is there…
suraj das
  • 117
  • 1
  • 3
  • 11
1
vote
1 answer

context.GetArgument() returning null with ByteGraphType

I´m learning how to use CustomScalar in graphql-dotnet. I have a tinyint column in my table and from what I have read, I´m supposed to use byte on this column in C#. After research I found out that I need to create a ByteGraphType, but I´m having…
1
vote
2 answers

TINYINT column & usage in Where clause - unexpected behaviour

I want to have a control to hide some products contemporarily on the website. I thought that it is easier to make the change on the database than to change the sql and to load the page again. I added a new column by: ALTER TABLE product ADD hide…
seeker
  • 61
  • 1
  • 11
1
vote
4 answers

mysql sum of tinyints

I have a table with five tinyint columns. If I make a query searching for a row, I get a result like this: select flag1, flag2, flag3, flag4, flag5 from mytable where whatever; Result set (image) What I need is to get the sum as if they were…
Uxio
  • 33
  • 4
1
vote
1 answer

Access linked table to SQL Server: TinyInt incorrect mapping

I got a SQL Server PriceLists table: CREATE TABLE [dbo].[PriceLists]( [PriceListId] [tinyint] IDENTITY(1,1) NOT NULL, [PLName] [varchar](20) NULL, CONSTRAINT [PK_PriceLists] PRIMARY KEY NONCLUSTERED When I link it into Access 2007, Access…
iDevlop
  • 24,841
  • 11
  • 90
  • 149
1
vote
4 answers

Using String enums in MySQL - performance question

I currently use enums as TINYINTs in MySQL database. My tables have a few million rows in them. We then map the enums from TINYINT to Strings elsewhere. I am considering storing these enums as Strings. If the Strings are indexed properly, does…
Anand S
  • 87
  • 1
  • 10
1
vote
2 answers

Trouble calling stored procedure with parameters

I am trying to update SQL Server Agent schedules using msdb.dbo.sp_update_schedule, but when I try to call the stored procedure from code I get exceptions. System.Data.OleDb.OleDbException: Error converting data type int to tinyint. at…
Tester101
  • 8,042
  • 13
  • 55
  • 78
1
vote
2 answers

C# - MySQL Prevent TINYINT(1) to Boolean Conversion

Is there any way to prevent the conversion from TINYINT(1) to boolean? Or perhaps convert it to int instead? My TINYINT(1) column can have data such as 0, 1, 2, 3. But it is being converted to False, True, True, True respectively. Here is the code…
CudoX
  • 985
  • 2
  • 19
  • 31
1
vote
5 answers

What is the best and safest method to update/change the data type of a column in a MySQL table that has ~5.5 million rows (TINYINT to SMALLINT)?

Similar questions have been asked, but I have had issues in the past by using ALTER TABLE tablename MODIFY columnname SMALLINT I had a server crash and had to recover my table when I ran this the last time. Is it safe to use this command when there…
Justin B
  • 110
  • 1
  • 8
1
vote
0 answers

Tinyint MYSQL to true/false string

I am using Angular2(typescript), Slim and Mysql. Mysql can store boolean only in 0/1 tinyint. However typescript can't convert 1/0 to boolean. Is the best way to convert it intro true/false string before send? Any ideas?
AndersonDev
  • 83
  • 1
  • 1
  • 8
1
vote
2 answers

MySQL Variable for human height (tinyint or smallint)

I am new to SQL! So if I want to add a person's height to my table (ex 1.86) what variable type should I use?? Tinyint or Smallint?
mike
  • 11
  • 1
1
vote
1 answer

Ado Entity: Treat Tiny as Boolean = false

I need to connect a .net application to a mysql database. When I add the tables to the model, all the columns with the type Tinyint are mapped like boolean. After Searching in mysql forum, i add "Treat Tiny As Boolean=false" in the connection…
Rumpelstinsk
  • 3,107
  • 3
  • 30
  • 57
1
vote
3 answers

Correct way to check against boolean values in Rails

I'm facing issues when I'm trying to check for boolean values in Rails. Earlier my condition used to check against a boolean value against 1 or 0 and this worked. But recently, this doesn't work any more. When I check them at MySQL level, the…
boddhisattva
  • 6,908
  • 11
  • 48
  • 72
1
vote
2 answers

Updating a tinyint filed in database using codeigniter

I'm trying update a tinyint field called inactive from 0 to 1 whenever a button is clicked. I'm sure that I'm getting the correct id so there's no problem there but I can't update the field. Here is my code for the view.
donna.paulsen
  • 61
  • 5
  • 14