Viewing 15 posts - 946 through 960 (of 2,648 total)
--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
WHERE (Insert_date > @LastJobRun OR Last_Updated > @LastJobRun)
November 4, 2020 at 3:30 pm
CASE
WHEN Phone IS NOT NULL OR MobilPhone IS NOT NULL THEN
CONCAT(CONCAT(LEFT(COALESCE(Phone,MobilPhone),3),'-'),
CONCAT(CONCT(RIGHT(LEFT(COALESCE(Phone,MobilPhone),7),3),'-'),
RIGHT(LEFT(COALESCE(Phone,MobilPhone),12),4)))
ELSE ''
END As PhoneNumber
That's very odd code. It looks like whoever wrote it didn't know you...
November 3, 2020 at 11:42 pm
https://support.microsoft.com/en-us/help/3177312/kb3177312-sql-server-2016-build-versions
SQL Server 2016 Service Pack 1 (SP1) Cumulative Update (CU) Builds
SP1 13.0.4001.0 KB3182545 November 16, 2016
October 29, 2020 at 4:59 pm
Do you have any indexes on the table you are inserting into?
If there are and it's loading into an empty table then it would be faster to disable all indexes...
October 29, 2020 at 4:49 pm
If possible I always revert to standard UPDATE and INSERT instead of using a MERGE, this will give better performance. This is also the recommendation from Microsoft: "Performance Tip: The...
October 21, 2020 at 10:11 pm
I was thinking more about this - realized we can do this:
SELECT weekend_day_count=y/7-x/7+(y+1)/7-(x-1)/7
FROM (VALUES(DATEDIFF(DAY,-53690,'1899-01-01') + 1,DATEDIFF(DAY,-53690,'1900-01-14') + 1))x(x,y)
We can specify the anchor date...
October 20, 2020 at 10:13 pm
How is a DiagnosisCode flagged as special in dim_OHADiagnosis?
How is a row in dim_Mapping identified as a Cancer Site diagnosis?
Which columns are used to join the tables together?
October 14, 2020 at 5:48 pm
if you output onto a file or to text it should give you the desired result
if you are querying on SSMS to the grid it will remove those.
If you...
October 9, 2020 at 8:53 pm
You start with
Select Sell * FeeMargin as Fee from TEST
Select Sell - Cost - Fee as Nett from TEST
Select Nett / Cost as NettMargin from TEST
If...
October 1, 2020 at 2:34 pm
view attached. It takes 2 hours to run. I'll try to run when there is not much activity in the server.
Nothing attached.
Can you paste in the whole query and...
September 25, 2020 at 1:57 pm
Viewing 15 posts - 946 through 960 (of 2,648 total)