Viewing 15 posts - 106 through 120 (of 1,390 total)
To calculate the points using column values would require to concatenate the string. Afaik if there are bad values you could use TRY_CAST with the 'geography' data type
March 28, 2024 at 2:22 pm
This reminds a little of a similar topic from a few weeks ago
https://www.sqlservercentral.com/forums/topic/inconsistent-query-execution-times
March 11, 2024 at 3:59 pm
One way could be to add the date and hour to the GROUP BY
select t.tagid, cast(v.ss_dt as date) day_dt, datepart(hour, v.ss_dt) hr,
...
March 6, 2024 at 7:29 pm
For the denominator you could sum SIGN(ABS()) functions. The SIGN function returns -1, 0, or 1 depending on if the input is negative, zero, or positive. The ABS function returns...
March 5, 2024 at 10:02 pm
Looks like if I add this in my query logic I'm getting the datetime desired
DATEADD(s,t_stamp/1000,'1969-12-31 20:00:00')
2024-02-01 01:00:00.000 2024-02-01 01:00:01.000
Struggle with doing the count of records per TagID within the...
March 5, 2024 at 8:05 pm
CREATE TABLE [dbo].[tmp_sqlt_data_1_2022_05](
[tagid] [int] NOT NULL,
[intvalue] [bigint] NULL,
[floatvalue] [float] NULL,
[stringvalue] [nvarchar](255) NULL,
[datevalue] [datetime] NULL,
[dataintegrity] [int] NULL,
[t_stamp] [bigint] NOT NULL,
PRIMARY KEY CLUSTERED
(
[tagid] ASC,
[t_stamp] ASC
)WITH (PAD_INDEX =...
March 4, 2024 at 7:06 pm
I need to be able to read the previous 5 Friday dates...
A good place to start could be with a query to generate the most recent 5 Friday dates...
March 1, 2024 at 9:45 pm
Here are two ways. My preference is for the second one. Since the FORMAT function was introduced in SQL Server 2012 (afaik) it's been known to have performance issues. Maybe...
February 28, 2024 at 6:44 pm
IMHO, Steve Collins' post (with a tiny tweak (change fn.n to fn.value) in the 2nd bit of code) contains the winning entries for simplicity IF you don't mind any...
February 20, 2024 at 6:56 pm
Using a tally function or GENERATE_SERIES maybe something like this
/* expand the date range using a tally function */
select v.calc_dt, count(*) active_policies
from #Policy p
...
February 16, 2024 at 6:03 pm
A while ago when I looked into GitHub Copilot, the service was based on ChatGPT-3.5 which is/was quite inferior imo to the ChatGPT-4 which was available at the time.
February 12, 2024 at 7:10 pm
Back in the day, before SQL Server 2012 was previewed, I worked on a project which started with a blank database. My teammate at the time started sending me articles...
February 9, 2024 at 1:25 pm
We'll have to see how the OP replies. Maybe my code only summed the part they want subtracted from the sum_qty
February 5, 2024 at 5:06 pm
All right, some data. This could be my only chance to use SQL for the day. For my part, this week and until it's done, I'm working on web development. ...
February 5, 2024 at 4:27 pm
Try this, maybe?
That old function could use an updating imo. As this is the 2022 topic GENERATE_SERIES and STRING_AGG are available. Also, not to say it's incorrect but...
January 29, 2024 at 4:13 pm
Viewing 15 posts - 106 through 120 (of 1,390 total)