Presto: parse an entire column from a string to a date [closed] - sql

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 days ago.
Improve this question
Current code I have is as follows:
select date_parse(column_name,'%Y-%m-%d %H:%i:%s')
This is the error I receive:
Error running query: line 1:19: Column "column_name" cannot be
resolved
I know that the format of the date I inserted is correct because I tested it with a value I have in the database and it returned the correct date value. It may be related to several records having no value in the column specified? Not exactly sure how I would account for that
I'm expecting the code to turn the entire column from a string into a date

Related

It seems like my min/max functions for my SQL code are reversed [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 days ago.
Improve this question
I'm using Microsoft SQL Server and I"m having issues writing a command for MIN and MAX functions.
It seems simple. The data type of the column is date time and the requested information is to find oldest/newest employee.
Below is the query I wrote:
select max(date_hired)
from staff;
select min(date_hired)
from staff;
But it seems like they are working in reverse. Min is giving me oldest and max is giving me youngest.

Dash in SQL Record [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 11 months ago.
Improve this question
I am trying to insert records into my table but keep getting an error due to the dash (Invalid column name 'NJB572'), how can I go about this? I have 2 columns in this table, both VARCHAR.
INSERT INTO dbo.Inventory VALUES
(131-NJB572, 'BROOM')
(PTI-I20, '9/16 IRONWORKERS')
(PTI-I16, '13/16" PUNCH');
You can use quotes to wrap the column names.
Try,
INSERT INTO dbo.Inventory VALUES
('131-NJB572', 'BROOM')
,('PTI-I20', '9/16 IRONWORKERS')
,('PTI-I16', '13/16" PUNCH');

Postgres column doesn't exist error on update [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I am trying to run the query below but I am getting an error ERROR: column "test.pdf" does not exist . I dont know why I am getting this error. I search for various links on stackover but none solved my problem like this PostgreSQL query -- column does not exist, Postgres error updating column data. Please help me find the problem.
bill is a type string field in bills table.
update bills
set bill = "test.pdf"
where id=3;
Change the double quotes you have around test.pdf to single quotes.

SQL Server column select query behaving strangely [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
When I do a select * over the table, the column Qty & QtyPending show a value of 6. However explicitly selecting the column names shows different values. Can anyone shed some light as to why this behavior is occurring?
This is a legacy system and database used is SQL Server 2000. The column data types are smallint.
So I have explicitly updated QtyPending to 6 using an Update query. This column now shows correct value.
Also added locstockid to the query, column Qty still shows different values.
Whatever I see in the image provided both the query have different LocStockId which means they can have different values
First :
LocStockId = 152319
Second :
LocStockId = 153219
I think you have mistyped.

Give an Alias to a column I've casted as a date [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
Basically I'm selecting all the rows from a table and stripping the time portion of the date using
CAST(CREATE_DATE AS DATE)
but my results give me the rows I need but the column is unnamed.
How do I give the column a name?
Like this:
Cast(create_date as date) as [Column Name Here]
You can omit the [] if you are not using spaces or reserved words in your column name (which is good practice anyway).