Viewing 15 posts - 16 through 30 (of 2,462 total)
Note that the "./" in your code is not required based on the XML Context. Also note that specifying that you need the elements' text, via text(), will improve performance.
For...
-- Itzik Ben-Gan 2001
May 4, 2021 at 3:29 pm
To better understand the problem and solution have a look at Well Formed XML:
-- Itzik Ben-Gan 2001
April 23, 2021 at 5:03 pm
This is my first time messing with JSON in SQL. The BOL entry on this helped me.
First, JSON is cases sensitive so, $.Data is not the same as $.data. Next,...
-- Itzik Ben-Gan 2001
April 15, 2021 at 1:49 pm
As Jeff mentioned, CONVERT + 101 gets you the formatting you need:
SELECT CONVERT(VARCHAR(10), GETDATE(), 101);
For the last day of the previous month:
SELECT EOMONTH(DATEADD(MONTH,-1,GETDATE()));
For the...
-- Itzik Ben-Gan 2001
April 14, 2021 at 10:04 pm
You can create your own INSTR function leveraging ngrams8k.
CREATE OR ALTER FUNCTION dbo.Instr8K
(
@string VARCHAR(8000),
@search VARCHAR(100),
@instance INT
)
/*
Created by...
-- Itzik Ben-Gan 2001
April 6, 2021 at 4:43 pm
For cleaner code you can leverage fnTally. Since fnTally leverages TOP, you can exploit row goals as Steve Collins mentioned above.
CREATE OR ALTER FUNCTION dbo.getYears(@year...
-- Itzik Ben-Gan 2001
February 18, 2021 at 6:40 pm
I don't have a server handy at the moment but what you are looking for is in the REPORTSERVER.DBO.CATALOG
This has the RDL XML (Report Definitions) which you can query. To...
-- Itzik Ben-Gan 2001
January 22, 2021 at 3:36 pm
@ Alan,
I'm honestly a little bit surprised that you're justifying a sort because it has a low row count. We know how that usually works out.
I was a little rushed...
-- Itzik Ben-Gan 2001
December 27, 2020 at 8:17 pm
apart from the performance that is likely to be quite bad has errors on its construct
The Construct is a problem but I suspect the performance should be fine, STRING_SPLIT is...
-- Itzik Ben-Gan 2001
December 26, 2020 at 1:21 am
there is currently no way to incrementally populate the table.
... a [Huge] fact table that gets regenerated nightly
This is a design/process issue more than a technical one. I'll put my...
-- Itzik Ben-Gan 2001
December 8, 2020 at 6:28 pm
A couple things to consider. First, In SSMS 2019 the actual execution plan will show you how much time each portion of the query took. You don't need that here...
-- Itzik Ben-Gan 2001
November 17, 2020 at 6:46 pm
Grab a copy of PatReplace8K and it should be easy to strip out what you need.
SELECT
pa.*,
Clean1 = CAST(ISNULL(pr.newString,0) AS FLOAT),
...
-- Itzik Ben-Gan 2001
November 17, 2020 at 6:20 pm
What you posted is similar to my first version of this except that I use my ngrams function to generate the tally table. Here's a simplified version of...
-- Itzik Ben-Gan 2001
August 4, 2020 at 3:41 am
Agreed. I said similar in this post from above...
I missed this.
The difference is that I did the split using an indexed view. This way the split only happens once,...
-- Itzik Ben-Gan 2001
August 3, 2020 at 6:46 pm
Just as a side note, depending on how often your columns are updated/modified, you can always split the string ahead of time using a permanent tally table like...
-- Itzik Ben-Gan 2001
August 3, 2020 at 6:38 pm
Viewing 15 posts - 16 through 30 (of 2,462 total)