What is a reasonable length limit on person "Name" fields?

I have a simple webform that will allow unauthenticated users to input their information, including name. I gave the name field a limit of 50 characters to coincide with my database table where...

Dynamic order direction

I writing a SP that accepts as parameters column to sort and direction. I don't want to use dynamic SQL. The problem is with setting the direction parameter. This is the partial code: SET...

How does one change the default varchar 255 of a column when importing data from Excel to Sql Server using Import Export Wizard?

I am trying to import data from excel to Sql Server using Import wizard. Everything seems fine in the first steps. The wizard is able to read the excel file and properly identify columns. But in...

Does SQLite3 not support foreign key constraints?

I am have a problem with SQLITE3. I have created 2 tables persons and orders using the following SQL script: sqlite> create table Persons( P_Id int primary key, LastName...

Cannot change column used in a foreign key constraint

I got this error when i was trying to alter my table. Error Code: 1833. Cannot change column 'person_id': used in a foreign key constraint 'fk_fav_food_person_id' of table...

An INTO clause is expected in this SELECT statement error when fetching from XMLTABLE

I am trying to run a script that involves an xmltable and I am getting a PLS-00428: an INTO clause is expected in this SELECT statement How could I correct my script and get 2 rows from the...

SQL Server rtrim ltrim and charindex

I have the following scenario John Doe [email protected] john [email protected] I want away that I can detect the first right space and just exclude everything to the left so I just get the email...

Stored procedure or function expects parameter which is not supplied

I am trying to insert data into a SQL Server database by calling a stored procedure, but I am getting the error Procedure or function 'SHOWuser' expects parameter '@userID', which was not...

SQL - The conversion of a varchar data type to a datetime data type resulted in an out-of-range value

I have been getting the following error when running a SQL to convert my data type value from varchar to datetime. Msg 242, Level 16, State 3, Line 1 The conversion of a varchar data type to a...

ERROR 1452: Cannot add or update a child row: a foreign key constraint fails

I have created tables in MySQL Workbench as shown below : ORDRE table: CREATE TABLE Ordre ( OrdreID INT NOT NULL, OrdreDato DATE DEFAULT NULL, KundeID INT DEFAULT NULL, CONSTRAINT...

Compare software version in postgres

Is there a way to compare software version (e.g. X.Y.Z > A.B.C) in postgres ? I'm searching for a function on string/varchar or a "version" type. I found out that...

Error occurred while setting parameters

I'm trying to call a procedure with MyBatis. This is the procedure signature: PROCEDURE pr_start(io_calc IN OUT TYPE_CALC, in_restart BOOLEAN DEFAULT TRUE, ...

Invalid use of a side-effecting operator 'INSERT'

CREATE FUNCTION insertrecord(@id int, @location varchar(20)) RETURNS INT AS BEGIN INSERT Into [dbo].[Location] (Id,Emploc)values(@id,@location) RETURN SCOPE_IDENTITY() END GO Above code...

get record by date range in CodeIgniter

I want to search records between two dates in CodeIgniter I have tried many methods but not getting required result. My Model function search($date1 , $date2 ){ ...

SQL - How to return a set of numbers after a specific word

In SQL i'm trying to return the first set of numerical values after a specific word. I only want the numbers from the string after the specific word. eg: ' hello : ' for example: hello : 123 ...

syntax error near 'CONSTRAINT

CREATE TABLE `DELIVERY` ( `del_ID` VARCHAR(45) NOT NULL, `del_date` DATETIME NOT NULL, `del_time` DATETIME NOT NULL, `VEHICLE_veh_ID` INT NOT NULL, `DRIVER_dr_ID` INT NOT NULL, INDEX...

Create column with duplicate data in same table psql

Postgres database I'm trying to find a faster way to create a new column in a table which is a copy of the tables primary key column, so if I have the following columns in a table named...

GreenPlum -- 'concat ' function in greenplum

Is there 'concat' function in GreenPlum? I can use concat function in postgresql and it works well, but when i use it in Greenplum, I got an error. select concat('a', 'b'); ERROR: function...

What is the issue with "FIELDS TERMINATED BY" and "LINES TERMINATED BY"?

So I have created a mysql table called specs and I want to import into this table a csv file. CREATE TABLE specs ( `Id` INT NOT NULL, `Brand` VARCHAR(40) NOT NULL, `Horsepower` INT NOT...

Mysterious error in CREATE PROCEDURE in MariaDB/MySQL

I tried to make a simple procedure in MariaDB 10.2 but I encountered an issue regarding variables defining. I am receiving (conn:107) You have an error in your SQL syntax; check the manual that...

Python SQL insert statement not working

I am trying to insert Arduino data into a database through Python, however, it will not do it. Basically I am assigning data that I read in from the serial port assigned to my Arduino and storing...

Copy file into another folder with django?

I need to upload profile images into diferent folders in Django. So, I have a folder for each account, and the profile image have to go to the specific folder. How can I do that? Here is my...

Encoded password does not look like BCrypt

I am using Spring Boot, Spring Security, OAuth2 and JWT to authenticate my application, but I keep getting this nasty error and I don't have any idea what is wrong. My CustomDetailsService...

Select shortest and longest string

Is it possible to select the shortest and longest strings by characters in a table? I have a CITY column of type VARCHAR(20) and I want to select the shortest and longest city names in...

postgres: Partitioned tables: split on unique values

background information in this query. Postgres version 10.10 I need to partition a table on unique values of a column (varchar) which contains a file name but I can not figure out how do this. ...

Laravel 6 - SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax;

when I run php artisan migrate to migrate this Schema public function up() { Schema::create('transaction_ins', function (Blueprint $table) { $table->bigIncrements('id'); ...

Flask-SQLAlchemy SQL Server Using strings as primary keys

I'm building a webpage which uses SQL Server as the database + Flask for the web framework. I want to be able to add users to my webpage, and created a SQLAlchemy class as below: from datetime...

PostgreSQL - How do I cancel what I am typing in psql terminal if I make a typo?

I am just getting started with SQL, and while I work I am making a lot of typos. For instance, after running psql mydatabase, I tried to make a table - postgres=# CREATE TABLE table_name...

SQL query to retreive data from multiple tables

I have 3 TABLES named PRODUCTS, INVOICE and INVOICE_ITEM. I want to retrieve the amounts due, paid, canceled and refunded for all products even if there is no balance. I am using MySQL 5.7. This...

Cannot drop the table 'tp_ladder', because it does not exist or you do not have permission

I have this code above and it shows an error on the DROP TABLE tp_ladder. I'm not quite sure how to fix it? And also I have not only one error like this, almost on every drop table row. Any...