I'm trying to cast my datetime as date to get rid of the time, but the query results still show the time. When I compare with what I see online, it looks correct.
How do I fix it?
..
, CAST("Process"."StartDate" AS date)
..
The result still shows like this:
4/14/2019 0:00
Update: I'm trying to use convert, as suggested below, but I'm getting Exception calling "fill" with "1" arguments.
There's probably something wrong with my syntax for the convert. Any ideas? All the online examples I see use datetime with convert. The complete query in powershell looks like this:
$SQLquery_Proc = @"
SELECT DISTINCT
Process.Process_ID
,"Process"."ProcessName"
,ProcessFacilities = STUFF(
(SELECT ',' + apf.FacCode FROM ProcessFacilities apf where apf.Process_ID = "Process"."Process_ID" FOR XML PATH ('')), 1, 1, ''
)
, "People"."Last_Name"
, "People"."First_Name"
, "People"."Middle_Initial"
, "People"."Degree"
, "Process"."P_ID"
, "People_Facilities_ALL"."FacCode" as "People_FacCode"
, "People_Facilities_ALL"."Current_status"
, "People_Facilities_ALL"."Status_category"
, convert("People_Facilities_ALL"."Status_from_date", 101) --issue?
, convert("People_Facilities_ALL"."Next_r_date", 101) --issue?
FROM
Process
left JOIN "DB"."dbo"."People" ON "Process"."PRACT_ID"="People"."P_ID"
left JOIN "DB"."dbo"."People_Facilities_ALL" ON "Process"."P_ID"="People_Facilities_ALL"."PRACT_ID"
ORDER BY
"People"."P_ID"
"@
Update2: I figured out how to get convert to work. Thanks for the help!
, convert(VARCHAR(23),"People_Facilities_ALL"."Status_from_date", 101)