Skip to main content

Questions tagged [datatypes]

Specifies the type of data being stored (string, date, numeric, etc).

0 votes
1 answer
36 views

Create table that has a sequence column counting from 1 for every different foreign key

Is there a way to define a table that has a sequence column counting from 1 for every different corresponding foreign key column? I want a "local" serial for every foreign key - sorry for ...
Greenhill's user avatar
  • 101
0 votes
0 answers
24 views

How well TimescaleDB supports custom types based on standard interger types like timestamp9?

There is a handy PostgreSQL extension timestamp9 that defined a type with the same name which is internally just bigint. I'm curious how well TimescaleDB support timestamp9 time in particular whether ...
oliora's user avatar
  • 101
0 votes
3 answers
170 views

How can a column's data type be safely reduced from NVARCHAR(max)?

My biggest table owes most of its size to a stupid NVARCHAR(max) column that I wager could easily be NVARCHAR(4000) or smaller. What steps can I take to become confident that this change is safe to ...
J. Mini's user avatar
  • 545
0 votes
1 answer
98 views

ERROR: duplicate key value violates unique constraint "sometable_pkey"

I have a giant table (500,000)+ rows with many columns that are varchar yes/no, and I want to reduce the size the db occupies, by changing the data types of varchar (yes/no domain), to int. Then ...
RandomNumberFun's user avatar
0 votes
1 answer
20 views

Looking for script to evaluate datatype usage

I'm using SQL Server 2016. I'm trying to find a script that could be run against all tables to evaluate the datatype of each column. The idea would be to get feedback on whether performance could be ...
pozzolan 's user avatar
2 votes
3 answers
107 views

Why is Varchar a lower data type precedence than INT?

Given the following tables: CREATE TABLE #a ( MyInt INT ) INSERT INTO #a VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10) CREATE TABLE #b ( MyVarchar VARCHAR(10) ) INSERT INTO #b VALUES('1'),(...
SE1986's user avatar
  • 2,000
4 votes
1 answer
294 views

Postgres strange conversion of the string 'now' to timestamp

It looks like postgres treats the string 'now()' the same as a call to the now() function. Why does postgres allow this? select 'now'::timestamp; or this? select 'now()'::timestamp; or even this? ...
Christian Long's user avatar
0 votes
0 answers
140 views

Uncaught mysqli_sql_exception: Data too long for column 'Data' at row 1

When I try to enter some very long data, (response from ChatGPT API) it doesn't get saved into sessions data which Im handling manually by storing in a MySQL table. $_SESSION[$propertyName."-&...
anjanesh's user avatar
  • 279
0 votes
1 answer
60 views

SQL Server : Partitioned table data type change

We have 40TB size SQL Server 2016 database. we have tables with 100+ billion rows per table which are partitioned. The older partitions are read only and new partitions are Read write. Recently for ...
TuBha's user avatar
  • 1
4 votes
2 answers
156 views

Table size increased after changing datatype from nchar to varchar

I am facing a strange behavior when changing datatype from nchar(100) to varchar(100) for one column. I understand if I change datatype of a column where data is present then it can increase size but ...
saadkaul's user avatar
  • 113
0 votes
1 answer
31 views

Recommendation on storing 3D flight data in PostgreSQL. Use POINTZM?

I am looking to store latitude, longitude (both decimal) and altitude (meters) for use with flight data in PostgreSQL 15. I have decided on using the POINT data type in PostgreSQL for latitude and ...
Justin's user avatar
  • 449
-1 votes
1 answer
1k views

Calling stored procedure with local custom type @ dblink

Newbie here. I am trying to execute stored procedure located at DBLINK. Here's my code: DECLARE TYPE ARRAY_VARCHAR2 IS TABLE OF VARCHAR2(32767); Vparams ARRAY_VARCHAR2 := ARRAY_VARCHAR2('p1', 'p2',...
Jasurbek Erkinboyev's user avatar
0 votes
2 answers
58 views

How I do I aggregate or perform calculations on a time datatype in "MM:SS:MS" in MySQL?

I'm currently working on an NBA project and I need to take the average minutes played per player, but I have no idea how to aggregate or calculate the time datatype. I know you have to convert it, but ...
thisisforfun's user avatar
0 votes
2 answers
166 views

Varchar for columns that store numerics/ids?

There is a table that has a column defined as follows: text_id varchar(255) NOT NULL I know that using varchar is optimal for storing text because it allows for variable length columns but in this ...
Jim's user avatar
  • 123
0 votes
1 answer
46 views

I want to store scientific numbers in Oracle, is BINARY_DOUBLE a good option?

I have a table where I store curve data/measurements e.g. points or polynomial constants. Those can be anything from normal numbers like 15000 to very small numbers like 123e-50. Is BINARY_DOUBLE a ...
Midas's user avatar
  • 123

15 30 50 per page
1
2 3 4 5
35