September 12, 2014 at 2:40 am
Dwain you do not need CLR to use regex 🙂
There is an old way to call Vbscript library
From t-SQL code 😉
September 12, 2014 at 4:11 pm
fregatepllada (9/12/2014)
Dwain you do not need CLR to use regex 🙂There is an old way to call Vbscript library
From t-SQL code 😉
sp_OA???
--Jeff Moden
Change is inevitable... Change for the better is not.
September 12, 2014 at 4:55 pm
Jeff Moden (9/12/2014)
fregatepllada (9/12/2014)
Dwain you do not need CLR to use regex 🙂There is an old way to call Vbscript library
From t-SQL code 😉
sp_OA???
I suspect they were talking about: http://www.sqlservercentral.com/scripts/Miscellaneous/30963/
Either way, I don't think we can get that into an iTVF.
-- Itzik Ben-Gan 2001
September 13, 2014 at 4:09 am
Yes, an antiquated COM way 🙂
November 6, 2014 at 2:01 pm
Just thought I add my minimalist CTE-based tally table generator:
declare @howmany int = 50;
with n1(n) as (select 1 from (values (1),(1),(1),(1),(1),(1),(1),(1),(1),(1)) n(n)),
n2(n) as (select 1 from n1, n1 n),
n4(n) as (select 1 from n2, n2 n),
n8(n) as (select 1 from n4, n4 n),
N(n) as (select top(@howmany) ROW_NUMBER() over(order by (select 1)) from n8)
select n from N
Note that I prefer (1),(1),... to (0), (0), ... since the latter makes my eyes go funny.
Also note that order by (select 1) works as well as order by (select null) and is shorter to write (Ok, so I'm lazy!)
Finally, my resulting table is called N to reflect its origin in the set ℕ -- the natural numbers
Gerald Britton, Pluralsight courses
November 6, 2014 at 4:55 pm
g.britton (11/6/2014)
Just thought I add my minimalist CTE-based tally table generator:
declare @howmany int = 50;
with n1(n) as (select 1 from (values (1),(1),(1),(1),(1),(1),(1),(1),(1),(1)) n(n)),
n2(n) as (select 1 from n1, n1 n),
n4(n) as (select 1 from n2, n2 n),
n8(n) as (select 1 from n4, n4 n),
N(n) as (select top(@howmany) ROW_NUMBER() over(order by (select 1)) from n8)
select n from N
Note that I prefer (1),(1),... to (0), (0), ... since the latter makes my eyes go funny.
Also note that order by (select 1) works as well as order by (select null) and is shorter to write (Ok, so I'm lazy!)
Finally, my resulting table is called N to reflect its origin in the set ℕ -- the natural numbers
How's this on your eyes?
declare @howmany int = 50;
with n1(n) as (select $ from (values ($),($),($),($),($),($),($),($),($),($)) n(n)),
n2(n) as (select $ from n1, n1 n),
n4(n) as (select $ from n2, n2 n),
n8(n) as (select $ from n4, n4 n),
N(n) as (select top(@howmany) ROW_NUMBER() over(order by (select $)) from n8)
select n from N
😛
Makes me see dollar signs.
My thought question: Have you ever been told that your query runs too fast?
My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.
Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
Since random numbers are too important to be left to chance, let's generate some![/url]
Learn to understand recursive CTEs by example.[/url]
[url url=http://www.sqlservercentral.com/articles/St
November 7, 2014 at 8:36 am
dwain.c (11/6/2014)
How's this on your eyes?
declare @howmany int = 50;
with n1(n) as (select $ from (values ($),($),($),($),($),($),($),($),($),($)) n(n)),
n2(n) as (select $ from n1, n1 n),
n4(n) as (select $ from n2, n2 n),
n8(n) as (select $ from n4, n4 n),
N(n) as (select top(@howmany) ROW_NUMBER() over(order by (select $)) from n8)
select n from N
😛
Makes me see dollar signs.
I love it!
Gerald Britton, Pluralsight courses
April 14, 2015 at 7:02 pm
Viewing 8 posts - 46 through 52 (of 52 total)
You must be logged in to reply to this topic. Login to reply