Viewing 15 posts - 16 through 30 (of 125 total)
Jeff Moden (6/24/2015)
Dohsan (6/24/2015)
Execution plan puts #2 at a higher cost of the batch
Just a bit of a sidebar here. The execution plan is a wonderful research tool...
June 24, 2015 at 10:01 am
mister.magoo (6/24/2015)
Alvin Ramard (6/24/2015)
mister.magoo (6/24/2015)
All these UNION queries will be scanning the table twice, yes?Each SELECT statement will cause the data to be read from the table.
Yes, to be pedantic,...
June 24, 2015 at 9:47 am
Not sure if the requirements here are getting mixed, hoping the two choices here will clear up what you want
USE FF_Winning_Together;
DECLARE @BaseData TABLE
(
LastName VARCHAR(20),
FirstName VARCHAR(20)
)
INSERT INTO @BaseData(LastName,FirstName)
VALUES('Apple','Bob'),
('Apricot','Jane'),
('Carrot','John'),
('Corn','Jon'),
('Eggplant','Ed'),
('Grape','Sam');
--Omit Letters when no...
June 24, 2015 at 8:49 am
ags.saputra88 (6/24/2015)
I Have Trend Record Data Using SQL Server 2012, Data Collected By Other Program Use SQL Server.
I Confuse Because Data Format Devided By Time Grouping,...
June 24, 2015 at 3:20 am
Would you have some example data for this with what your expected output would be?
I thought it was just a standard pivot question until I reread what you were asking....
June 24, 2015 at 2:03 am
Below makes use of a "Cross Tab" which if you search for on this site you should find some articles detailing it.
--Create Test Data
WITH BaseData (TagName,Time_1,Data_1,Time_2,Data_2)
AS
(
SELECTA.TagName,
A.Time_1,
A.Data_1,
A.Time_2,
A.Data_2
FROM(
VALUES('Test1',CAST('07:00' AS TIME),20,CAST('07:30' AS TIME),40),
('Test2',CAST('07:00'...
June 24, 2015 at 1:50 am
serg-52 (6/19/2015)
Dohsan (6/19/2015)
Here's one using a recursive CTE, if I have time I'll have a go at a set based solution
This will not produce correct result for the...
June 19, 2015 at 7:58 am
Here's one using a recursive CTE, if I have time I'll have a go at a set based solution
DECLARE @Chuff VARCHAR(8000) = 'NA,T1,T1a'
DECLARE @SplitValues TABLE (Item VARCHAR(8000));
INSERT INTO @SplitValues (Item)
SELECTitem
FROMdbo.DelimitedSplit8K(@Chuff,',');
WITH...
June 19, 2015 at 3:49 am
If the provided list of numbers will always have the same number of items, then something like this should work.
DECLARE @Chuff VARCHAR(50) = 'NA,T1,T1a';
;WITH Test
AS
(
SELECTItemNumber,
Item
FROMdbo.DelimitedSplit8K(@Chuff,',')
)
SELECTT.Item,
T1.Item,
T2.Item
FROMTest AS T
CROSS
JOINTEST AS T1
CROSS
JOINTEST AS...
June 19, 2015 at 2:41 am
NineIron (6/17/2015)
June 17, 2015 at 7:09 am
Great news that you've managed to fix it, would you also be able to share the solution? May be useful for others in the future.
June 17, 2015 at 1:32 am
helal.mobasher 13209 (6/16/2015)
June 17, 2015 at 1:14 am
Sure it can be done more efficiently than this, but this appears to work:
WITH AddRank
AS
(
SELECTGT.DT,
GT.ClientID,
GT.BegTime,
GT.EndTime,
GT.Duration,
--Remove Partition by DT if you want times grouped regardless of day)
BegRank = DENSE_RANK() OVER (PARTITION...
June 16, 2015 at 6:01 am
pietlinden (6/15/2015)
http://www.sqlservercentral.com/articles/Best+Practices/61537/%5B/quote%5D
I've generated some test data based on your attachment for...
June 16, 2015 at 3:26 am
Viewing 15 posts - 16 through 30 (of 125 total)