how to insert sqlite table date field value? - ruby-on-rails

i have create table like below and inserting the value using insert query from ruby on rails but it's not updating the date value with table. Rest of the field values updating correctly....
give me
Table structure:
CREATE TABLE [Approval] (
[InstallationName] TEXT NULL PRIMARY KEY,
[Approver] TEXT NULL,
[ApprovalCRCdate] DATE NULL,
[ApprovalTime] TIME NULL,
[ApprovalCRC] NUMERIC NULL,
[ApprovalStatus] TEXT NULL
)
insert query:
insert into [Approval] values('_EGONSEOSX0043','dfgdfg','6/6/2011' ,'16:13:14' ,324234 ,'Approved')

maybe you should change the field's type to TEXT?
SQlite's DATE datatype has numeric affinity and you are using / that is not a number.
But I think it should all get inserted since SQLite has 'dynamic typing'

Related

description varchar(max) NULL , function shows NULL for rows having values

While using [description] varchar NULL for pulling a column from a CSV file to create a table using a powershell script.I am seeing description column shows NULL for rows have values too .
Please let me know how to get all the rows in description column with actual values .

how to change datatype from integer to character in psql?

ı need to change the datatype of a column .
ALTER TABLE students
ALTER COLUMN "Dname" character varying (30) ;
I tried this but it doesn't work.
You should use this statement instead.
ALTER TABLE students
MODIFY Dname varchar2(30);
Best,
Yassine

How are indexed columns with NULL values treated?

Informix-SE 4.10, 7.32 and IDS 11.70: I have an index on a DATETIME YEAR TO FRACTION column I recently added as a timestamp to a table with ~800K rows. This column is being populated as users update or add new rows. So far, ~7K rows have DATETIME values, but the rest are NULL. How does SE and IDS treat the rows with NULL valued DATETIME columns when querying, updating and sorting?.. Are those rows ignored? The reason for the index is to support a query to find the most recently added or updated row with a "select max(datetime_col)" statement. Would a descending order index on this column provide better performance?
Sorting for a descending order the NULLS will be the last, in the ascending (default) will be in the top.
But the way it is treated depend on the way you filter your data.
You cannot compare NULL with a value, it is always false.
Hence, if in that table you try to fetch all rows in which the date is greater than CURRENT the rows with the column in NULL will not be fetch.
In a similar away if you try to fetch all rows in which the date is lesser than CURRENT the rows with the column in NULL will not be fetch.
What you want is to test it if it IS NULL or IS NOT NULL.

How to leave a blank field in table in sqlplus?

In sql, if some fiels are to be left blank while inserting the values in the table, how shall we do it?
For eg. For name field, i want to insert 'First Name' & 'Last Name' but not 'Middle Name'.
But the field is already present by default in the table.
If I have understood you correctly, you simply need to execute an INSERT sentence, without using the columns (fields) you don't want to inform.
As an example, if you have three columns and don't want to inform column2 use
INSERT INTO table_name (column1,column3)
VALUES (value1,value3);
instead of
INSERT INTO table_name (column1,column2,column3)
VALUES (value1,value2,value3);
Hope it helps!

Delphi 5 - size mismatch on TField

On an ADOQuery I've created a String Tfield and set the it's size to 24(from Fields Editor).
When I'm trying to assign to this field a 24 characters length string (qry.fieldbyname('fieldname').asString), only first 20 characters are added. I don't understand why.
How is the query populated with data? If you are doing a select against a table then the column will have the same width as in the table schema. Check how the column is defined in your database.

Resources