181 questions
0 votes
2 answers
170 views
Dynamic Column alias based on a function in BigQuery
I am trying to alias a column based on a DateTime function in BigQuery. Below is my query snippet, SELECT SUM(CASE WHEN CAST(AsOfDate AS DATE) >= DATE_TRUNC(CURRENT_DATE,MONTH) ...
1 vote
1 answer
633 views
Postgresql is not accepting datetime format from CSV file
I am trying to load a CSV file to my PGadmin database (on my local computer). I am running PostgreSQL16 with PGadmin4 as the user interface. I am trying to upload the date data as follows: UniqueID ...
1 vote
1 answer
137 views
SQL behaviour when using string literal vs using date literal
Suppose I have this two queries: SELECT * FROM payments WHERE created < DATE '1967-01-01' SELECT * FROM payments WHERE created < '1967-01-01' And created field is a date field. I would like to ...
-1 votes
2 answers
96 views
Return past 3 appointment and next 3 appointments
I need to get the past 3 appointments and the next 3 appointments from a certain date. Each of these queries give the expected result. My problem is that I need the results together. I can't use UNION ...
0 votes
1 answer
536 views
SQL Oracle find records that were made until specified time
I'm quite new to SQL and I got stuck on one thing. Let's say that I have a database, where new records are being created every few mins and there is a 'dstamp' row which contains time when specific ...
0 votes
1 answer
590 views
Snowflake sql query to assign weeks to a month
I know about Snowflake date function to find out day, week, month, year, etc. I want to have weeks start from Saturday each week to next Saturday. following gives an idea how to extract, but need ...
1 vote
4 answers
104 views
Split column, and then convert different date types to standard date format (YYYY-MM-DD) - SQL Server
I have requirement to split column in 2 separate columns and then convert multiple date types column to standard date format column. CREATE TABLE Report (Id INT, Reference VARCHAR(30)); INSERT INTO ...
0 votes
3 answers
454 views
How to display all columns of the datatype DATE when one column is actually a date and others are just time?
I am learning SQL and using Oracle SQL Developer. I have a table that contains the following columns FlightDate DepartureTime ArrivalTime I have inserted values using either TO_DATE('10:45', 'hh24:...
1 vote
1 answer
669 views
Get dates for last 30 days dynamically in SQL
I have below SQL which gives me count of files received in particular country according to date. But here dates are hard coded. I want them dynamically. I want it in such a way that whenever I run ...
0 votes
2 answers
682 views
Java / SQL -How to group time in intervals of 30 minutes or 1 hour
I need a solution to group the times of entry and the display the respective time interval and count of users/records during that time interval eg Time Interval Count 07:00 AM-07:30 24 12:30 PM-...
0 votes
1 answer
62 views
Pass sql date from talend to Rest Api
I want to send a post request to the rest API which includes an SQL date format, when I try to send the request with YYYY-MM-DD format, its showing bad request. How to properly send the data.
-3 votes
1 answer
400 views
how to convert month date in a text column into datetime
I have a table containing two columns like this: Month_Date Year Dec 31 2018 May 01 2020 Jun 05 2021 Jan 18 2022 Jul 19 2019 I hope to combine the Month_date and year in the ...
-1 votes
1 answer
5k views
How to extract day of week from timestamp
I am trying to extract the day of the week from a timestamp in SQL Server. I am specifically looking for the SQL Server equivalent syntax to EXTRACT. I want to count how many fields are in each day of ...
0 votes
1 answer
387 views
Conversion failed Error SQL Date format Mismatch with C# Datatable datetime fromat depending on system calender setting
We have a Stored Procedure in SQL Server which expects datetime column to be in MMddyyyy format and results in error Conversion failed when converting date and/or time from character string. ...
0 votes
1 answer
416 views
How do I import Dates from Excel to SQL Server varchar column in m/d/yyyy format?
I have an excel from where I am bulk importing data to SQL server through .Net code (Dataset.WriteToServer method). Now, my excel has dates in m/d/yyyy format, e.g. 9/21/2021. The destination SQL ...