Viewing 15 posts - 931 through 945 (of 2,645 total)
You need to start by looking at the view definition of vwRequests
January 6, 2021 at 6:20 pm
If all the columns you require are not contained in the non-clustered index then the database would have to do a seek and a key-lookup or a full table scan...
January 6, 2021 at 2:13 am
INSERT INTO tblWorking
(
Col1,
Col2,
Col3,
...
)
SELECT Col1,
Col2,
...
January 3, 2021 at 12:58 pm
CREATE TABLE #Employee
(
EmpId int NOT NULL,
EmpName nvarchar(20) NOT NULL
);
GO
CREATE TABLE #Swipe
(
SwipeTime_UTC datetime NOT...
January 2, 2021 at 4:48 pm
IF OBJECT_ID('tempdb..#Data', 'U') IS NOT NULL
DROP TABLE #Data
GO
select *
into #Data
from (values
(1,'A',1),
(2,'B',1),
(3,'A',1),
(3,'A',2),
(4,'B',1),
(5,'A',1),
(5,'B',1),
(6,'A',1),
(6,'A',2),
(6,'A',3),
(7,'A',1),
(8,'A',1),
(9,'B',1)) x(Id,SubType,Ref)
GO
select Id, SubType, Ref,
...
December 31, 2020 at 3:09 am
"I am trying to count the number of customers that signed up in the last hour "
select COUNT(*)
from #CUSTOMERS
where CREATE_DATE > DATEADD(HOUR,-1,CURRENT_TIMESTAMP)
December 17, 2020 at 4:59 pm
Are you terminating the preceding statement with a semicolon?
You can start statements that begin with "WITH" with a semicolon:
;WITH ret AS(
December 11, 2020 at 12:50 pm
declare @Seconds int = 31578
select @Seconds [@Seconds],
t.Hours,
u.Minutes,
...
December 2, 2020 at 4:10 pm
If you don't already have similar indexes try these two indexes and see if there is an improvement:
create index IX_Cuentas_1 on dbo.Cuentas(idCuenta) INCLUDE (idjerarquia,Cuenta)
create index IX_Cuentas_2 on...
December 1, 2020 at 8:14 pm
--DECLARE @CurrentDate as date='2020-11-25'
DECLARE @CurrentDate as date='2020-12-10'
;WITH Data (Id, WeekName, WeekDate) AS (
SELECT 5, 'Gameweek 1', CONVERT(date,'2020-12-01')
UNION
...
November 26, 2020 at 1:05 pm
--DECLARE @CurrentDate as date='2020-11-25'
DECLARE @CurrentDate as date='2020-12-10'
;WITH Data (Id, WeekName, WeekDate) AS (
SELECT 5, 'Gameweek 1', CONVERT(date,'2020-12-01')
UNION
...
November 26, 2020 at 2:19 am
DECLARE @Data TABLE (Name nvarchar(100));
INSERT INTO @Data(Name)
VALUES
('Microsoft Windows NT Workstation 10.0'),
('Microsoft Windows NT Workstation 10.0'),
('Microsoft Windows NT Workstation 10.0'),
('Microsoft Windows NT Server 10.0'),
('Microsoft Windows NT Workstation...
November 24, 2020 at 10:32 am
Why have you got DISTINCT in the select from the table variable, can't you make a table variable with distinct values already in it?
Create a primary key or an index...
November 16, 2020 at 4:39 pm
Currently, I don't have the value stored anywhere.
How do you know when the job last ran?
November 4, 2020 at 4:55 pm
I do not. What would be the best way to go about that as a variable?
You might not need a variable and just use a subquery to get it.
Where...
November 4, 2020 at 4:40 pm
Viewing 15 posts - 931 through 945 (of 2,645 total)