One of the servers (infact them all) use MSSQL at work.
I'm editing a query but I want to know if this does as expected
convert(datetime, CONVERT(CHAR(12),(GETDATE()+(CASE WHEN (DATEPART(month, GETDATE()+65) < 4) THEN 65*(4-DATEPART(month, GETDATE()+65)) ELSE 65 END)),3)+ ' 23:59:59'))
What it needs to do is
This bit here
(GETDATE()+(CASE WHEN (DATEPART(month, GETDATE()+65) < 4) THEN 65*(4-DATEPART(month, GETDATE()+65)) ELSE 65 END))
On GETDATE()+65 = jan return 65*3
On GETDATE()+65 = feb return 65*2
On GETDATE()+65 = mar return 65
On GETDATE()+65 >= Apr return 65
I cant edit the whole query, just that the where, as I dont have access to the entire query.
I cant test either as the systems locked off, I only have blind access via the client for the Patient Access System.
So if it messes up i cant tell why.
Anyone know if that works...
I'm editing a query but I want to know if this does as expected
convert(datetime, CONVERT(CHAR(12),(GETDATE()+(CASE WHEN (DATEPART(month, GETDATE()+65) < 4) THEN 65*(4-DATEPART(month, GETDATE()+65)) ELSE 65 END)),3)+ ' 23:59:59'))
Code:
convert( datetime, CONVERT(CHAR(12),( GETDATE()+( CASE WHEN (DATEPART(month, GETDATE()+65) < 4) THEN 65*(4-DATEPART(month, GETDATE()+65)) ELSE 65 END ) ),3)+ ' 23:59:59'))
What it needs to do is
This bit here
(GETDATE()+(CASE WHEN (DATEPART(month, GETDATE()+65) < 4) THEN 65*(4-DATEPART(month, GETDATE()+65)) ELSE 65 END))
On GETDATE()+65 = jan return 65*3
On GETDATE()+65 = feb return 65*2
On GETDATE()+65 = mar return 65
On GETDATE()+65 >= Apr return 65
I cant edit the whole query, just that the where, as I dont have access to the entire query.
I cant test either as the systems locked off, I only have blind access via the client for the Patient Access System.
So if it messes up i cant tell why.
Anyone know if that works...
Comment