Viewing 15 posts - 151 through 165 (of 4,085 total)
The page that you linked to contains three separate approaches to a very similar problem. If you are having problems with one or more of those approaches, show us what...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
March 17, 2023 at 1:48 pm
There are basically two approaches that you can use ROW_NUMBER() and GROUP BY.
ROW_NUMBER() method, you would create a row number with a partition on your columns (Col1,...J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
March 16, 2023 at 1:14 pm
The TYPE directive just says to return the results as XML rather than a string. TYPE Directive in FOR XML Queries
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
March 14, 2023 at 3:19 pm
A newbie replied to a decade old post. I'm not sure you're going to get much info from the original poster.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
March 10, 2023 at 7:23 pm
EVERY SINGLE TIME you post data you have to be reminded of the best way to post data. I've come to the conclusion that you don't want to learn, you...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
March 10, 2023 at 7:19 pm
related_resources is an array of JSON and you haven't supplied the index for the array. The array is zero-based. See the example below.
Declare @JSON Nvarchar(max) = N'{"notes"...J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
March 9, 2023 at 7:00 pm
Maybe STUFF() would work better if this text is always at the beginning.
SELECT STUFF([error], 1, CHARINDEX('Quote', [error])-1, '')Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
March 9, 2023 at 6:34 pm
This produces the exact same results as your working query, but I think that the logic is simpler to follow.
WITH TierChanges AS
(
SELECT ui.UserID
...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
March 9, 2023 at 2:28 pm
Given the column naming convention, I think there might be a simpler solution than using an EAV. This assumes that there are three sets of weights: PWT, PNT, and PTT...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
March 7, 2023 at 2:21 pm
I believe that the following solution will perform better.
WITH last_visits AS
(
SELECT t.primarydoc
, t.client_id
, t.visitdoc
, t.doc_id
, t.visit_id
, t.visit_date
...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
March 6, 2023 at 5:45 pm
Create some test data:
DROP TABLE IF EXISTS TestTable
GO
CREATE TABLE TestTable
(
NoSeqTrt INT,
NoSeqIti INT,
idPointsrv INT
)
;
GO
-- Populate...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
February 23, 2023 at 3:44 pm
A CTE is part of data manipulation language (DML), specifically an INSERT, UPDATE, SELECT, or DELETE statement. An IF...THEN...ELSE is a workflow statement. You CANNOT have a workflow statement in...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
February 16, 2023 at 7:39 pm
So where do these linked integers come from? Why, for example, is 1 linked to 1, 2, and 3, but the numbers 8 to 14 only linked...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
February 9, 2023 at 8:36 pm
Hi Jeff,
Thanks for the response. The Window functions cannot be used in update statements directly, so I used a different technique, whereby I had partitioned the data of unique...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
February 9, 2023 at 5:08 pm
This site is dedicated to MS SQL Server. While there may be people here that can give you advice, you're likely to get better advice from a site that is...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
January 12, 2023 at 4:59 pm
Viewing 15 posts - 151 through 165 (of 4,085 total)