Viewing 15 posts - 1 through 15 (of 18 total)
Hope it helps!
;WITH dataCTE AS
(
SELECT *
FROM BM3 bm3
UNION ALL
SELECT *
FROM BM3_HT_WT
August 16, 2017 at 4:45 pm
Hope it helps!
IF OBJECT_ID('tempdb..#tmpTest') IS NOT NULL DROP TABLE #tmpTest ;
CREATE TABLE #tmpTest
(
Id INT IDENTITY(1, 1) NOT NULL
,...
August 16, 2017 at 12:24 am
You should always output results from procedures and use them specially if it it something like RowCount or a result of particular sql statement within encapsulated code (stored procedure), else...
January 28, 2016 at 3:03 pm
Something to play with :-
;WITH dataCTE AS
(
SELECT i.*
, Sequence =...
January 24, 2016 at 6:22 pm
It happens.
Normally in such cases, I find my best old mate SQL Profiler very useful. Completely decoupled from the application layers and capable of tracking things happening in SQL server
December 8, 2015 at 9:14 pm
Here is something to play with
DECLARE @T TABLE (Id INT IDENTITY(1,1) PRIMARY KEY, CategoryId INT NULL, SKU VARCHAR(60) NOT NULL)
INSERT INTO @T ( CategoryId, SKU)
SELECT 3200, '978-654-321' UNION ALL
SELECT 3200,...
December 8, 2015 at 7:42 pm
This may be better than above -- Post 2012
;WITH dataCTE AS
(
SELECT t.*
...
December 6, 2015 at 7:21 pm
Using Recursion
You should be able to do without recursion
;WITH orderedDataCTE AS
(
SELECT t.*
...
December 6, 2015 at 6:09 pm
It may be slower, but still quite an interesting way of playing with t-sql
Everything is not always about speed!
I am happy with tally function, great way to tackle things.
December 3, 2015 at 4:54 pm
Recursive Solution
-- sample date
DECLARE @rng-2 TABLE (Id INT, RangeStart BIGINT, RangeEnd BIGINT, Category INT, NumberCount INT)
INSERT INTO @rng-2
SELECT 123, 120000006660, 120000006690, 5, 31 UNION ALL
SELECT 123, 120000011660, 120000011670, 5, 11...
December 3, 2015 at 4:19 pm
A recursive solution, but it should be carefully used. Ideally should be used only if start and end date gaps is max few hundred days.
Anyways, here it is and I...
December 2, 2015 at 5:39 pm
Hello,
In your example, 3PM to 5PM and then next day 8AM to 10AM = 2 + 2 = 4 Hours (and 4 hours is not exactly 1/2 of 9)
Can you...
December 2, 2015 at 4:52 pm
Select SQL
SELECT p.*
, xLkp.*
FROM dbo.ProductTable p
CROSS APPLY -- We know table dbo.lkpTable will always have atleast one (default) row...
December 2, 2015 at 4:43 pm
Hello all,
I moved into data warehouse after being a hard core c# developer for multiple years. My take on LinQ to SQL is as below.
1. Nothing should be banned. Everything...
April 6, 2014 at 6:00 pm
Hello, I have tried my best to understand your code and come up with a solution which should work. I used xml path and few string manipulation.
Note: I could not...
March 25, 2014 at 5:06 pm
Viewing 15 posts - 1 through 15 (of 18 total)