Viewing 15 posts - 571 through 585 (of 1,396 total)
You could try PATINDEX twice to trim off any non 0-9 or A-z character. It works with any number of *'s, leading/trailing spaces, etc
select calc.*, substring(ucl.PROCEDURE_COMMENT,
...
September 9, 2021 at 6:29 pm
Suppose an offset day variable '@day_offset' is declared and then subtracted from GETDATE(). To get a daily report you could CAST the 'datetime' column into 'date' using CROSS APPLY (VALUES...
September 8, 2021 at 2:58 pm
The function dbo.GetDateCDT(GETDATE())) returns the 'Central Standard Time' (which adjusts for DST afaik) as date? These lines are equivalent?
-- returns Central Time truncated to date?
select dateadd(day, datediff(day,...
September 8, 2021 at 12:13 pm
It appears you're attempting to create "running totals" using the LAG function (which doesn't work). You could maybe try SUM(...) OVER instead
September 3, 2021 at 3:20 pm
Thanks for the code Scott. I was messing around with the GETDATE function and +/-# parameter and how it worked wasn't totally clear to me. I looked and didn't find...
September 1, 2021 at 4:24 pm
Well, more could be said about all of this. I'm sticking by what I wrote tho. Phil Factor article aside, in this particular question it seems reasonable to infer the...
September 1, 2021 at 2:05 pm
Thank you for this response. It does work, but it's not what I need, because I need to compare with historical data, so I can't use getdata() in this...
September 1, 2021 at 12:29 pm
For comparison purposes the date and time columns could be combined in a virtual table ('conv') into datetime columns. Then maybe 3 separate CASE statements so as not to overlap...
August 31, 2021 at 7:43 pm
He didn't check with you first before writing the article? Is it because money and smallmoney are really bigint and int? I'm pretty sure major payment API's like Stripe uses...
August 31, 2021 at 1:51 am
Here's one by Phil Factor on red-gate.com
August 30, 2021 at 10:43 pm
What about an open source SQL Server project to create a generic forum with no dependencies on UI and which allows for a 3rd party OAuth 2 identity provider? The...
August 30, 2021 at 3:21 pm
Imo a type conversion to an approximate data type and a comparison to 0 are not strictly what the question asked. As you know well float and money data types...
August 30, 2021 at 2:44 pm
All right Sergiy's correct about the CROSS APPLY's not being necessary. What I don't agree with is using MONEY (VARCHAR converts to FLOAT too fwiw) and comparing the sum to...
August 30, 2021 at 11:16 am
On second thought, instead of individually calculating the decimal costs they could be added all together into one value 'dCost'. Also, a combination of TRY_CAST and ISNULL could be used...
August 29, 2021 at 8:22 pm
The obligatory comment is regarding the problems arising from storing numeric data as varchar instead of decimal(#, #). Assuming you're stuck with the DDL you could try something like this. ...
August 29, 2021 at 1:00 pm
Viewing 15 posts - 571 through 585 (of 1,396 total)