Viewing 15 posts - 1,171 through 1,185 (of 7,614 total)
Below is some code that will probably do what you want. I strongly recommend you run it first with the EXEC() commented out. If all of the output looks ok,...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
November 2, 2021 at 6:31 pm
If I understand correctly, you just need to add the condition on the JOIN:
...previous_part_of_query_same_as_before...
INNER JOIN #temp_Lookback t2 ON t1.Id = t2.PreviouslyCompletedId AND t2.Type = 'F'
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
November 2, 2021 at 3:29 pm
You'd typically want to use dynamic SQL for this, so that only the relevant columns were included in the comparisons. You'll also typically want to recompile to get a specific...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
November 2, 2021 at 3:22 pm
It definitely could, esp. if there's an index containing the type column.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
November 1, 2021 at 5:58 pm
First try refreshing the view. The "*" in the view may be causing some issues if the table has changed after the view was created.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
November 1, 2021 at 4:59 pm
I'd say it depends on how often you need to show the resolution duration. That's a rather complex calc to do repeatedly..
I have to disagree. If you use...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
November 1, 2021 at 4:58 pm
I'd say it depends on how often you need to show the resolution duration. That's a rather complex calc to do repeatedly. And presumably the Resolution Time would only be...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
November 1, 2021 at 3:17 pm
Sorry.
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[DelimitedSplit8K] (
@pString varchar(8000),
@pDelimiter char(1)
)
RETURNS TABLE WITH SCHEMABINDING
AS
/*SELECT *...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 29, 2021 at 8:04 pm
A few other things need changed to match SQL Server syntax as well.
CREATE TABLE "circuits" (
"circuitId" int NOT NULL IDENTITY(1, 1), --<<--
"circuitRef" varchar(255)...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 29, 2021 at 7:04 pm
Let's fall back on the old reliable dbo.DelimitedSplit8K function, to avoid doing all the parsing ourselves.
;WITH sample_data AS (
SELECT * FROM ( VALUES
...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 29, 2021 at 6:56 pm
UPDATE ...
SET FirstName = PARSENAME(LEFT(EmailAddress, CHARINDEX('@', EmailAddress) - 1), 1),
LastName = PARSENAME(LEFT(EmailAddress, CHARINDEX('@', EmailAddress) - 1), 2)
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 28, 2021 at 2:49 pm
Yes to the most RAM you can get and actually use for SQL Server: 128GB for Standard Edition, as much as you can afford for Enterprise.
Note that, if Standard Ed,...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 27, 2021 at 7:56 pm
You can write them to a table -- add an identity for ordering -- and then SELECT from that table, for example:
SELECT sql_text AS [--sql_to_run]
FROM #some_table_name
ORDER BY $IDENTITY
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 27, 2021 at 6:54 pm
You didn't say what the result should be if it is tied, for example, 2F and 2M? In that case, I went with 'FemaleMix', adjust that if you need to.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 27, 2021 at 6:14 pm
You need to change the Options..., Query Results, SQL Server in your SSMS to display more chars.
You don't need (nor likely want) to toggle to text. A grid display should...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 27, 2021 at 6:04 pm
Viewing 15 posts - 1,171 through 1,185 (of 7,614 total)