Viewing 15 posts - 1,111 through 1,125 (of 1,439 total)
Another way...
WITH ns(n) AS (
SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL
SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL
SELECT 7 UNION ALL...
June 8, 2009 at 5:04 am
jcrawf02 (6/5/2009)
Gianluca Sartori (6/5/2009)
I don't know if this is a proof, but for sure it is "half a proof".Regards,
Gianluca
Does that make it a theorem?
More of a conjecture I think
June 5, 2009 at 7:58 am
Suggest you look at EXCEPT (and maybe INTERSECT) in BOL
June 5, 2009 at 4:39 am
CrazyMan (6/5/2009)
I cant really get the numbers table, can you please throw some light...
June 5, 2009 at 3:25 am
robert_daniel (6/4/2009)
June 5, 2009 at 3:03 am
Using a numbers/tally table
--Pre-populate with characters of length > 1
DECLARE @Lengths TABLE(Ch CHAR(1) PRIMARY KEY, Length INT)
INSERT INTO @Lengths(Ch,Length)
SELECT 'A',2 UNION ALL
SELECT 'E',2
Declare @Text1 Varchar(max)
Set @Text1 ='Test Message'
SELECT SUM(COALESCE(l.Length,1))
FROM Numbers...
June 5, 2009 at 2:55 am
lxz20 (6/4/2009)
June 4, 2009 at 10:00 am
lxz20 (6/4/2009)
Your 2nd CTE still blew up with the following sample data:
insert into NodeItem
select 1 NodeID, -1 ParentNodeID -- 1st root
union all select 2 , NULL -- the 2nd...
June 4, 2009 at 9:32 am
Jackal (6/4/2009)
I was just looking for some alternative means of acheiving something;
Lets assume we have a customer table, each customer has a unique id and additional data.
We have procedure...
June 4, 2009 at 8:35 am
Mark (6/4/2009)
lxz20 (6/4/2009)
Your CTE will not work in my instance because Root Nodes may not have ParentNodeID = 0. As I said, there might be many root nodes....
June 4, 2009 at 8:03 am
lxz20 (6/4/2009)
Your CTE will not work in my instance because Root Nodes may not have ParentNodeID = 0. As I said, there might be many root nodes. ...
June 4, 2009 at 7:54 am
This should give you all of the invalid nodes
WITH HierarchyTree (NodeID, ParentNodeID, Step) AS
(
SELECT NodeID, ParentNodeID, 1
FROM NodeItem
WHERE ParentNodeID = 0
UNION ALL
SELECT r.NodeID, r.ParentNodeID, t.Step + 1...
June 4, 2009 at 7:40 am
See if this helps
DECLARE @d1 DATETIME
DECLARE @d2 DATETIME
SELECT @d1='20090602 10:23', @d2='20090602 14:24'
SELECT DATEDIFF(minute,@d1,@d2)/60 AS Hours,DATEDIFF(minute,@d1,@d2)%60 AS Minutes
June 2, 2009 at 7:24 am
Suggest you try both approaches, in my experience "count(*) over()" doesn't perform particularly well.
May 26, 2009 at 7:40 am
Viewing 15 posts - 1,111 through 1,125 (of 1,439 total)