Viewing 15 posts - 1 through 15 (of 16 total)
You could use CTE (Common table expressions) and ROW_NUMBER().
I could use Derived Table instead CTE.
July 19, 2013 at 8:13 am
I see first_value and last_value function, but do not see second or third value function!
How can I write for example second_value() function by using analytical window function?
January 29, 2013 at 12:07 pm
ScottPletcher (1/24/2013)
declare @search_pattern_should_be varchar(100)
set @search_pattern_should_be = '%[[][[][%] SQL Server [%]]]%'
--example
select case when @string like '%[[][[][%] SQL Server [%]]]%'
then'Matched' else...
January 24, 2013 at 11:30 am
Thanks,
So the second one can be more simpler like this:
LIKE '$[$[$% SQL Server $%]]' ESCAPE '$'
January 23, 2013 at 10:20 pm
It's easy no need to sample data, I want an alternative LIKE for this without ESCAPE.
like '%?[?[?% SQL Server ?%?]?]%' ESCAPE '?'
I wrote this code, but that is not correct:
like...
January 22, 2013 at 11:34 pm
I forgot to say thank you.
The generalizability is necessary.
I get 324 unique, fruity combos!
Because your solution return duplicate combos! you need to filter them.
For example see ComboNo IN (1, 11,...
January 3, 2013 at 9:19 pm
I get 324 unique, fruity combos!
I think your result is not correct. Run you query with following sample data:
INSERT INTO #n_objects
SELECT 1, 'Apple' UNION ALL
SELECT 2, 'Orange' UNION ALL...
January 3, 2013 at 8:48 pm
The recursive CTE may not scale well as the length of the strings increase. Both sets of options really need to be tested to determine which is better solution.
My...
January 3, 2013 at 5:27 pm
declare @t table(id int, string varchar(500))
insert @t values (1,'abcABC,0123456789~!@'),(2,'123abcdefghijklmnopqrstuvwzyz');
with cte1 as
(
select id,
0 nbr,
cast(string as varchar(500))...
January 3, 2013 at 5:16 pm
declare @t table(id int, string varchar(500))
insert @t values (1,'abc0123456789'),(2,'123abcdefghijklmnopqrstuvwzyz');
with cte as
(
select id,1 nbr, cast(string as varchar(500)) string
from @t
union all
...
January 3, 2013 at 4:39 pm
where RecordId = 3212
and
(
'2012' > ANY
(select AlphaNumeric2 union all
select AlphaNumeric5 union all
...
January 3, 2013 at 3:50 pm
Thank you Sean Lange.
😀
select m.RecordId,m.NumberForSearch into #dump
from table1 m join table2 a on m.RecordId = a.RecordId
cross apply (
select 1
from (
values(a.AlphaNumeric2),
(a.AlphaNumeric5),
...
January 3, 2013 at 3:28 pm
where RecordId = 3212
and not(replace(AlphaNumeric2 + AlphaNumeric5 + AlphaNumeric7 + AlphaNumeric9, '2012', '') = '')
January 3, 2013 at 2:54 pm
Only in some case also:
;with cte as
(
select m.RecordId,m.NumberForSearch,
a.AlphaNumeric2,a.AlphaNumeric5,a.AlphaNumeric7,a.AlphaNumeric9
from table1 m join table2 a on m.RecordId = a.RecordId
where RecordId = 3212
)
select RecordId,NumberForSearch into...
January 3, 2013 at 2:48 pm
What about this:
where RecordId = 3212
and 1 in
(select case when AlphaNumeric2 = '2012' then 0 else 1 end union
select case when AlphaNumeric5 =...
January 3, 2013 at 2:08 pm
Viewing 15 posts - 1 through 15 (of 16 total)