Viewing 15 posts - 121 through 135 (of 4,820 total)
The problem here is that you are trying to update a table you aren't even referencing in the UPDATE statement's FROM clause. I'm not really sure why you're asking the...
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
August 2, 2020 at 11:45 pm
Not sure about whether performance will matter here, but the following code might be better on performance:
WITH ORDERED_DATA AS (
SELECT
T.Company,
T.[Month],
T.Sales,
ROW_NUMBER() OVER(PARTITION BY T.[Month] ORDER BY T.Sales DESC)...
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
August 2, 2020 at 11:21 pm
This is a most interesting topic, and I just have to toss a hat in the ring. Decided to try to make the code as simple as possible and see...
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
August 2, 2020 at 10:44 pm
Pietlinden,
Joining a second time isn't going to get another row... not that we know what the OP needs here, but just sayin' ...
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
July 31, 2020 at 6:27 pm
Try the following:
CREATE TABLE dbo.emp_availability (
emp_no INT,
day_of_week INT,
from_time VARCHAR(20),
to_time VARCHAR(20)
);
INSERT INTO dbo.emp_availability (emp_no, day_of_week, from_time,...
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
July 31, 2020 at 6:25 pm
Also, you might be able to use scalar functions you create in tempdb, based on making your parsing logic smart enough to detect a query length long enough to cause...
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
July 31, 2020 at 5:59 pm
Outside of CROSS APPLY, you'd probably have to use Global Temp Tables - they're that way when the table name starts with "##" (2 pound signs). Meaning that you run...
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
July 31, 2020 at 5:55 pm
Without further detail, I'm not sure what you mean when you say "How can i get the query to show two different results." Does that mean separate rows? As you've...
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
July 31, 2020 at 5:49 pm
Not in a tablix... You MUST use a matrix to do this. Grouping by Year as a "row group", and then your other groups would need to be "column groups". ...
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
July 31, 2020 at 5:41 pm
As I said before, you need a matrix and not a tablix. However, you can effectively turn the tablix into a matrix by adding a column group. The year would...
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
July 30, 2020 at 11:14 pm
Once again, I'll agree with Brian. Seems likely that a trigger on the table being updated might be doing something that tracks changes, and possibly to a varchar(max) or nvarchar(max)...
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
July 30, 2020 at 11:01 pm
I agree with Brian. "Pluggable into any SQL database" is just not going to realistically be possible when you're looking for an MS SQL specific feature AND you're going to...
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
July 30, 2020 at 10:55 pm
Okay, so we're talking about 2,000,000 rows of 55 columns of up to 100 characters each, plus all the element overhead. This could easily be a full Gigabyte of RAM...
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
July 30, 2020 at 10:44 pm
Okay, to start, you're not grouping by year because you are putting the year in the same row as the other groups... you probably need a matrix instead of a...
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
July 29, 2020 at 8:16 pm
Okay, so let me get this straight. Your data is insufficiently unique, so rather than actually fixing the real problem, you'll go to the transaction log and DBCC page commands...
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
July 29, 2020 at 8:10 pm
Viewing 15 posts - 121 through 135 (of 4,820 total)