Viewing 10 posts - 466 through 475 (of 475 total)
Hi
Here's another variation that should do the trick. No function this time, just a query
create table #t1(name varchar (100))
GO
INsert into #t1
select '1234ABC123456XYZ1234567890ADS'
GO
INsert into #t1
select 'cbv736456XYZ543534534545XLS'
GO
INsert into #t1
select 'cbv736456XYZ543534534545XLS2134488'
GO
;with...
October 8, 2012 at 1:33 pm
Hi
You could try the following
CREATE FUNCTION replace6plusint(@s1 varchar(100)) RETURNS TABLE AS RETURN
WITH
firstRun AS (
SELECT replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(@s1,'0','^'),'1','^'),'2','^'),'3','^'),'4','^'),'5','^'),'6','^'),'7','^'),'8','^'),'9','^'),'^^^^^^','------') a
UNION ALL
SELECT replace(a,'-^','--')
FROM firstRun
WHERE a like '%-^%'
),
secondRun AS (
SELECT replace(a,'-','x') b, charindex('^', a) p
FROM...
October 4, 2012 at 1:19 pm
Hi
I thought that I would try something out of left field with this as a matter of interest. I use Geometry a lot and thought it would be interesting...
September 27, 2012 at 1:55 pm
You could try the following
I'm sure that this can be improved though and I don't know if it will scale very well as it is recursive.
IF OBJECT_ID('TempDB..#table','U') IS NOT NULL
...
September 25, 2012 at 10:07 pm
Shame there isn't implicit conversion for money to int in the following
SELECT -(~$)
It would have made a good answer
September 24, 2012 at 1:17 pm
Not the shortest but interesting
SELECT COUNT(*)
September 20, 2012 at 5:30 pm
Hi
You could try the following. Of course it will only work for the three TransType_IDs
SELECT SUM(CASE WHEN TransType_ID = 0 THEN AMOUNT ELSE null END) SumAmount_TransType_ID_0
, SUM(CASE WHEN TransType_ID...
September 18, 2012 at 2:08 pm
You could try this
;WITH cte AS (
SELECT a.itemid, a.date
, 0 level
, null parentid
, a.itemid rootid, a.date rootdate
, CASE WHEN EXISTS(SELECT 1 FROM @tableB k WHERE a.itemid = k.parentid) THEN 1...
September 6, 2012 at 2:55 pm
You could try the following query.
select f.Path, f.FolderName, f.FolderSize, d.FileName, d.FileSize
from @Folders f
left outer join @Files d on f.Path = d.Path
group by grouping sets ((f.Path, Foldername, FolderSize), (f.path, d.FileName,...
September 3, 2012 at 2:50 pm
Very interesting article and it will make me think about the way I use functions (and statistics!) from now on.
I hit a problem with recursion using the InitialCapFaster function
SELECT b.string...
August 1, 2012 at 9:54 pm
Viewing 10 posts - 466 through 475 (of 475 total)