Viewing 15 posts - 1,336 through 1,350 (of 2,645 total)
You will get better responses if you provide some more test data with your required results.
Also you should make it consumable so in a format like:
DECLARE @Planning_Proposal_Temp...
November 7, 2019 at 2:12 pm
;WITH MyTable AS
(
SELECT * FROM (VALUES
('A', '06/11/2019 09:00', '06/11/2019 09:15'),
('A', '06/11/2019 09:05', '06/11/2019 09:20'),
...
November 6, 2019 at 11:12 pm
Here are two methods:
IF OBJECT_ID('tempdb..#SlowInserts','U') IS NOT NULL BEGIN
DROP TABLE #SlowInserts
END
GO
CREATE TABLE #SlowInserts(Id int IDENTITY(1,1) NOT NULL, Comment varchar(50) NOT NULL)
GO
SET NOCOUNT ON
DECLARE...
November 6, 2019 at 10:58 pm
I just took the columns out of the CONCAT from my previous query so they are separate columns, I think this is exactly what you have asked for:
November 5, 2019 at 11:54 am
Hi Jonathan
Thank you very much for your help, which is greatly appreciated.
However, I was probably not so concise in describing what I need. My goal is to produce new...
November 4, 2019 at 5:25 pm
;with cte as
(
select ts.sensor,
ts.temperature,
...
November 2, 2019 at 6:21 pm
SELECT
[LastDayOfThisMonth] = EOMONTH(GETDATE()),
[SecondLastDayOfThisMonth] = DATEADD(DAY,-1,EOMONTH(GETDATE()))
I think EOMONTH was introduced in SQL 2012 and this is the SQL 2008 board.
October 31, 2019 at 2:47 pm
The reason it is ordered is the database engine will need to do a sort to group all the columns in the group by that are equal together. From your...
October 30, 2019 at 11:46 pm
From your description it sounds like you want it to use OR instead of AND:
SELECT *
FROM Cars c
WHERE c.Origin <> 'USA'...
October 30, 2019 at 4:14 pm
I don't know why the query is suddenly taking longer. I just had a quick look at the SQL and saw that bit looked a bit odd. I don't think...
October 30, 2019 at 3:46 pm
select s.c1,s.c2,s.c3, COUNT(*)*IIF(m.c1 IS NULL,0,1) cnt
from stg_tbl s
left join main_tbl m
on m.c1=s.c1
...
October 29, 2019 at 5:55 pm
Not dynamic, but if you know the values that will appear in item then:
select a.name,
sum(case when b.item = 'red' then...
October 28, 2019 at 9:31 pm
This bit looks odd and long-winded:
AND EXISTS (
SELECT 1
FROM (
SELECT PARTY_ID
FROM C_B_ACCOUNT WITH (NOLOCK)
GROUP BY PARTY_ID
HAVING count(1) = 1
) A
WHERE A.PARTY_ID = ACCT.PARTY_ID
)
I would write it like...
October 28, 2019 at 5:46 pm
It could be that someone is creating large tables for temporary storage in tempdb. I don't see anything wrong with this if they have done it to improve the performance...
October 28, 2019 at 11:47 am
I see your description and your code but I still can't figure out what you're trying to do. Are you simply trying to show what the Thursday week start...
October 25, 2019 at 12:43 pm
Viewing 15 posts - 1,336 through 1,350 (of 2,645 total)