|
|
|
|
-
Leszek Gniadkowski Posted 4 Months ago through Blogs
Functions:gocreate function dbo.utf16_to_utf8 (@s varbinary(8000),@endian bit) returns varchar(8000) -- @endian 0-little 1-big null-BOMbegin if @s is null return null if @endian is null and not (convert(char(4),@s,2) = 'FEFF' or convert(char(4),@s...
|
-
Leszek Gniadkowski Commented 4 Months ago through Ask
code
select dok,stawka,min(zid),max(zid) from
(select *,zid - row_number() over(partition by dok,stawka order by zid) grp from @t) x
group by dok,stawka,grp
order by min(zid)...
|
-
Leszek Gniadkowski Commented 4 Months ago through Ask
Some hints:
1. From http://www.unicode.org/reports/tr10/
*Treatment of punctuation varies. In some situations a punctuation character is treated like a base letter. In other situations, it should be ignored if there are any base, accent, or case dif...
|
-
Leszek Gniadkowski Commented 4 Months ago through Ask
Unicode sorting ignores minus char in string - [http://www.unicode.org/reports/tr10/][1]
CREATE TABLE #TBL(ID NVARCHAR(20))
GO
INSERT INTO #TBL
SELECT 'aaa----bbb1' UNION ALL
SELECT '-----aaa-bbb2'
GO
SELECT MAX(ID)...
|
-
Leszek Gniadkowski Commented 5 Months ago through Ask
select
e.Employeeid
,min(e.name)
,max(ei.Attemptdate)
,count(distinct datediff(d,0,ei.Attemptdate))
from Employee e
inner join EmpIN ei on e.Employeeid = ei.Employeeid
group by e.Employeeid...
|
|
|
-
Leszek Gniadkowski Commented 6 Months ago through Ask
>But you still need to pad with zeroes to handle numbers with more than 1 digit.
or convert to int / bigint - order by cast(reverse(parsename(reverse(c),1)) as bigint),cast......
|
-
Leszek Gniadkowski Commented 6 Months ago through Ask
@dishdy
>Have you got something clever for ss 2005? :-)
select c from cte
cross apply
(
select right(replicate('0',10) + x.i.value('.', 'varchar(8000)'),10)
from (select cast(('<p>' + replace(c,'.','</p><p>') + '</p>') as x...
|
-
Leszek Gniadkowski Commented 6 Months ago through Ask
order by cast('/' + replace(x,'.','/' ) + '/' as hierarchyid) -- sql 2008
order by parsename(x,1),parsename(x,2),parsename(x,3),parsename(x,4) -- max 4 levels...
|