create table that has a date item in sqlite3 database in python - date

I'm making a database for a website and it needs to take the users input of a date but I think I can do that bit. The part I'm struggling to do is create a table with the date item. What do I need to tell it to do when creating the table I've gotcreate table Results (GameID integer,Date ???????, primary key(GameID)
I just need to to know what I set date to as its not an integer real or text.
I'm using python 3.2

SQLite does not have a built-in date type.
SQLite can store dates as a string or a number.

Related

Setting toDate function as arrival time Anylogic

I'm already struggling for days to use dates from excel in a proper way in anylogic..
I've created a database in where the date is formulated as integers in different columns since otherwise excel is messing up the dates (for example year=2021 , month=12 day=5 hour=6 minute=44 second=0 stands for 2021/12/5 6:44:00)
Now I know this can be converted to a date by the function toDate(year, month, day, hour, minutes seconds). But how can I use this integers to create agent with specific parameters from the database in a source and add to a custom population?
The most simple way is to add a column where the function toDate(......) is added in the database but I do not know how to do this (see picture if it is unclear). Or are there other solutions?
One way: use Dynamic Events.
Create one and in the action code, write mySource.inject(1)
In Main, on startup, load all dbase rows and create a DE for each row, below assuming it is only with an hour-column:
(Use the database query wizard to adjust your query).
In your source object, set it to "call of inject() function"
This will work, but it is quite cumbersome, as you can see. Much easier if you get your Excel right and just import the date column clean and well so you can use the Source option "arrival table in database" directly. I know you need regular arrivals, so maybe code that up in Excel to give you these on specific dates...

SSAS Tabular - No relation between fact table and 2nd Date dimension

I have 2 date fields in my fact table start_date and end_date.
Fact table is connected to the dim date with start_date.
I need to slice data by the second date field so I've created another date dimension similar to the first dim date and connected the key to the end_date in the fact table, but for some reason there's no relation between them when I browse the cube.
I made sure the keys are in the same format, data type etc.
The new dim date is 'marked as date table'.
What am I missing?
Thanks a lot.
Try with TabularEditor:
https://github.com/otykier/TabularEditor/releases/tag/2.13.0
open your Model and check relationships if you don't see the one you want, you can just add a new one.
You can also create multiple relationships to the same table using different columns (but as inactive), you can use this inactive relationship in calculation using USERELATIONSHIP.

How can I manage to have an auto-insert timestamp value in my table in SQL-Server?

Im working on a project. My project contains a c# program and an attached database. I need to have a column to record the time, when data is inserted into my table.
My goal is to be able to report my data in different time intervals.
what I have already tried: I have included a timestamp column in my table. I thought adding a timestamp column will automaticly do the job for me. but its not recording time by itself I guess I have to enter time to it from a source.
I have searched my problem in google but there was not any how-to question. all questions were about the differences between time data types.
The best way is have a column with nvarchar(15) type and set it to
DateTime.Now.ToString();
in c# .
So, you can make strings you want with the date time like : yyyy/MM/dd or MM/yyyy/dd
maybe this url will help you :
https://learn.microsoft.com/en-us/dotnet/api/system.datetime.tostring?view=netframework-4.7.2
I had to either use CURRENT_TIMESTAMP
Microsoft suggestion for having a Timestamp
which actually I didn't use it myself in my project.
What I did do was to have a label and a timer in my C# program. I would trigger the timer with a click on a button and stop it somewhere in my program and store the time value in a variable (let's call it Timevariable). Then when I'm entering other information in my database, I would use that variable to store the time which I chose it to be a timestamp in my database with the following code:
sqlcon.Open();
SqlCommand sqlcmd = new SqlCommand("AddTime", sqlcon);
sqlcmd.CommandType = CommandType.StoredProcedure;
sqlcmd.Parameters.AddWithValue("#otherInformation",source of that Information);
sqlcmd.Parameters.AddWithValue("#QTimeStamp", Timevariable);
sqlcon.Open();
I'm using a stored procedure here.

Query date range for date saved in a text field in IBM Notes and Domino

There is a date saved in a text field. I'm trying to get documents collection when the field is in a date range using db.FTSearch method. But > and < doesn't work in a text field. Are there any way to convert text field? I'm not familiar with IBM Domino and have tried #TextToTime but doesn't work.
A few ways:
use db.Search instead of db.FTSearch; the syntax is completely different though, plus it is rather slow, but if you have to execute your query once per day or even less, you're fine
write an agent that converts the text date fields into new real date fields, so you can do your FTSearch; make sure you adapt the form used to create the documents, so that it also creates those date fields
use a view, where the first 2 columns contain the date value of your text fields, and sort the view; you'd have to use getDocumentByKey (but I'm not sure this works)
Your date is stored as text, so you need to use #TextToTime().
I.e.,
FIELD #TextToTime(field1) >= [01/01/2018] AND
FIELD #TextToTime(field1) <= [01/19/2018]

Date column is not displayed in sql

I am using Oracle express for the database comparisons (Teradata and Adaptive Server IQ)
When i am trying to connect a database and try to display all the columns using select function, all the columns except date columns are getting displayed.
can i know a solution for this?