Viewing 15 posts - 1,906 through 1,920 (of 2,171 total)
Yes, I know. We all hoped that the new SQL 2005 PIVOT operator really should be a PIVOT, and not just a rewrite for a lot of case statements...
But who...
July 25, 2006 at 3:40 pm
And if you have several tables like tblProperties, just add a UNION after the red text in my previous rewritten SP.
SELECT Aircraft,
PropertyName,
Value
FROM tblProperties
UNION
SELECT Aircraft,
...
July 25, 2006 at 3:38 pm
Using this slighty rewritten SP from my article will do the trick for you. It uses no aggregations!
CREATE PROCEDURE uspAirplaneProperties
AS
SET NOCOUNT ON
CREATE TABLE #Aggregates
...
July 25, 2006 at 3:34 pm
You can not use PIVOT for SQL 2005 since you need to hardwire the columns.
Your choice of method is dynamic SQL.
And selecting MAX of 1 record is very fast!
July 25, 2006 at 3:25 pm
For the sample data provided, is this the wanted output?
Type of Request Priority Median
--------------- -------- ------
KCR Request 1 5.0
KCR Request 2 5.0
KCR Request 3 5.5
MPR Request 1 2.0
July 25, 2006 at 2:59 pm
Bruce might mean an ordinary transform of a resultset. Changing rows to columns and columns to rows.
Take a moment or two and read my recent article here
http://www.sqlservercentral.com/columnists/plarsson/pivottableformicrosoftsqlserver.asp
That...
July 25, 2006 at 2:40 pm
Use star sign
select *
or
insert into sometable
select *
July 25, 2006 at 10:29 am
Try begin with STDEV and STDEVP functions and see what they do for you.
An example of calculating z-score is
zscore = (product category sales - product avg) / product stdev
Meaning
zscore =...
July 25, 2006 at 10:06 am
It is @ProgramID and @CustomerID that is missing an alias!
SELECT @ProgramID AS ProgramID,
@CustomerID AS CustomerID,
P.PaymentTransactionID,
P.Period,
P.PaymentTypeID,
P.CurrencyCode,
P.GLAccountID,
Amount = convert(decimal (12,2), (P.AmountUSD /...
July 25, 2006 at 6:00 am
This will produce only the pairs where there are matches, which will be much smaller resultset that previous
-- prepare test data
declare @table table (s int, item int)
July 25, 2006 at 3:48 am
Will this code do?
-- prepare test data
declare @table table (s int, item int)
insert @table
select 1, 1 union all
select 1, 2 union all
select 1, 3 union all
select 2, 2 union all
select 3, 5
July 25, 2006 at 2:55 am
-- Prepare test data
declare @test table (Location2 varchar(7), Measure_Name varchar(8), Location1 varchar(7), Measure_Value smallmoney)
insert @test
select 'S00152', 'TY_Sales', 'Chicago', 2111.05 union all
select 'S00152', 'PY_Sales', 'Chicago', 2200.65 union all
select...
July 24, 2006 at 2:26 pm
You have to explicit set GRANT on every SP you want the user to have acccess to.
July 24, 2006 at 11:23 am
-- Prepare test data
declare @table table (seq tinyint, area smallint, page tinyint)
insert @table
select 1, 300, 0 union all
select 1, 200, 0 union all
select 1, 100, 0...
July 24, 2006 at 10:00 am
SELECT Code,
COUNT(*)
FROM Table
GROUP BY Code
HAVING COUNT(*) > 1
July 24, 2006 at 9:47 am
Viewing 15 posts - 1,906 through 1,920 (of 2,171 total)