Viewing 15 posts - 871 through 885 (of 3,501 total)
Jeff,
Gotta get some sleep... Just got home, so I'll do it in the morning sometime. It's a really simple tree with 3 levels, but I think it's enough to get...
October 10, 2019 at 6:18 am
Just to explain it to myself or visualize what's going on, I drew a tree of parts with assemblies etc. I started with something I could get my head around...
October 9, 2019 at 12:07 am
Something like this? (Use a Calendar table).
use tempdb;
GO
-- count the dates between two days excluding weekends
CREATE TABLE #Calendar (TheDate DATE PRIMARY KEY CLUSTERED);
GO
DECLARE @TheDate DATE = '01-Jan-2019'
WHILE...
October 6, 2019 at 9:12 pm
Got some dummy data? Create table script... you know the drill.
October 6, 2019 at 2:41 am
That’s what I was thinking. Get max of level and return all parts having that same level.
Makes sense! Thanks!
October 4, 2019 at 6:05 pm
This worked... ugly, but it worked:
DECLARE @string VARCHAR(200) = 'All I want (for Christmas) is better (TSQL) coding skills (this year).'
--remove everything between parens
--remove the parens
DECLARE @StartPos...
October 4, 2019 at 3:12 am
Use CHARINDEX() to find the position of the open/close parens, and then use SUBSTRING() to get the parts between them, and REPLACE() to swap that with an empty string?
Sounds like...
October 4, 2019 at 12:09 am
Aaron,
is there an easy way to identify those?
Pieter
October 3, 2019 at 7:18 pm
Live and learn, I guess.
I might have to revisit this and rewrite it when I learn how to do it better. I think part of the challenge is that it's...
September 30, 2019 at 6:06 pm
The part I finally figured out that threw me at first is that you filter what the CTE returns by adding a WHERE clause outside the CTE (seems to painfully...
September 30, 2019 at 4:16 pm
FWIW, here's my current code... I *think* it works, but maybe it's just AdventureWorks playing tricks on me.
CREATE PROC PartsSheetForSalesOrder
@SalesOrderID INT
AS
WITH Parts(AssemblyID, ComponentID, PerAssemblyQty, EndDate, ComponentLevel) AS ...
September 30, 2019 at 5:53 am
Here's my code so far... How do I just return the lowest level components? I feel like I'm missing a join or something somewhere...
Here's my code so...
September 29, 2019 at 5:21 pm
If I sequence the Work Orders somehow, I could use one of those dreaded cursor things... then I could do something like this:
September 25, 2019 at 10:23 pm
DELETE FROM TableA
WHERE EXISTS (SELECT 1
FROM TableB
WHERE TableB.DeleteDate = TableA.RecDate);
?
I guess I should have asked what you tried.
September 24, 2019 at 6:20 pm
This is a "note to self", I guess, so...
Self,
this is as far as I have gotten. it's not quite right maybe, because I have yet to figure out how to...
September 24, 2019 at 6:11 am
Viewing 15 posts - 871 through 885 (of 3,501 total)