Viewing 15 posts - 4,606 through 4,620 (of 10,143 total)
ravi@sql (5/9/2013)
Thank you for your valuble reply .. finally am able to over come my prob .. here is the query
Declare @date Datetime='2013-06-16 00:00:00.000'
select...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
May 10, 2013 at 1:48 am
j2cagle (5/9/2013)
I just cut-n-pasted from above:DECLARE @VARBINARY VARBINARY (16)
SET @VARBINARY = CONVERT(VARBINARY (16),'0x0000000000018662',1)
SELECT @VARBINARY;
go
DECLARE @VARBINARY VARBINARY (16)
SET @VARBINARY = CONVERT(VARBINARY (16),'0x0000000000018662',0)
SELECT @VARBINARY;
go
You missed the @@version...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
May 9, 2013 at 10:08 am
Lynn Pettis (5/9/2013)
When I run the following in SQL Server 2008 R2:
DECLARE @VARBINARY VARBINARY (16)
SET @VARBINARY = CONVERT(VARBINARY (16),'0x0000000000018662',1)
SELECT @VARBINARY;
go
DECLARE @VARBINARY VARBINARY (16)
SET @VARBINARY = CONVERT(VARBINARY (16),'0x0000000000018662',0)
SELECT @VARBINARY;
go
I get;
0x0000000000018662
0x30783030303030303030303030313836
Same here.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
May 9, 2013 at 9:58 am
j2cagle (5/9/2013)
That's what I've been trying, but that results in:0x30783030303030303030303030313836
Interesting - I get the same as you if I execute the batch against SQL Server 2000. Against 2k8 it appears...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
May 9, 2013 at 9:46 am
j2cagle (5/9/2013)
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
May 9, 2013 at 9:35 am
How many rows are returned if you comment out the WHERE clause?
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
May 9, 2013 at 9:22 am
-- standard crosstab query
SELECT [SlNo#] = ROW_NUMBER() OVER(ORDER BY GrandTotal DESC),
OrganizationName, HumanResourse, Finance, HelpDesk, ITDevision, GrandTotal
FROM (
SELECT
OrganizationName,
HumanResourse= SUM(CASE WHEN DeptName = 'HumanResourse' THEN Total ELSE 0 END),
Finance=...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
May 9, 2013 at 9:04 am
paul.j.kemna (5/9/2013)
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
May 9, 2013 at 8:29 am
Thanks for the feedback, and you're welcome. An actual plan for the revised query would be very interesting - if you have the time.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
May 9, 2013 at 7:12 am
suneet.mlvy (5/9/2013)
drew.georgopulos (5/8/2013)
all take the same hit on Sort?Is there any way to mitigate that or conditions that make one cheaper than another forcing uniqueness?
thanks very much
drew
I don't think...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
May 9, 2013 at 6:52 am
Eugene Elutin (5/9/2013)
--WHERE LEFT(CompanyIdentifier, 5) != 'EXCLU' -- NOT SARGABLE
WHERE CompanyIdentifier NOT LIKE 'EXCLU%' -- SARGABLE
Yeah, I thought about this one too, but if you check attached execution plan...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
May 9, 2013 at 6:35 am
paul.j.kemna (5/9/2013)
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
May 9, 2013 at 6:31 am
Here's a basic crosstab query to get you started. It might just work 😉
SELECT
CompanyIdentifier,
,COALESCE(Field1,Field2)
,COALESCE(Field3,Field4)
,Field5
FROM (
SELECT
CompanyIdentifier,
Field1 = MAX(CASE WHEN FieldIDNumber = 1 THEN Data END),
Field2 = MAX(CASE WHEN FieldIDNumber =...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
May 9, 2013 at 5:22 am
-- Have a look at the result of this:
-- ('#' is an arbitrary divider between the columns of one table and the columns of another)
SELECT h.*, '#' '#', x.*
FROM...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
May 9, 2013 at 5:10 am
ravi@sql (5/9/2013)
ya i agree but thats what my requirment .. any other way to over come this ?
CASE can only return one data type.
An ordinary column can only have...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
May 9, 2013 at 4:12 am
Viewing 15 posts - 4,606 through 4,620 (of 10,143 total)