Viewing 15 posts - 4,771 through 4,785 (of 5,504 total)
Why didn't PIVOT work?
Example:
SELECT prod, [newyork] AS 'newyork',[berlin] AS 'berlin',[moscov] AS 'moscov',[zurich] AS 'zurich'
FROM
(SELECT prod,point,price
FROM SalesPricesTable) p
PIVOT
(
MAX (price)
FOR point IN
( [newyork],[berlin],[moscov],[zurich] )
) AS pvt
ORDER BY prod
Another way would be...
November 14, 2009 at 3:58 pm
Jeff Moden (11/14/2009)
November 14, 2009 at 3:42 pm
Well, I didn't post it for three reasons:
1) The function I'm using is mostly copied from one of the articles I referred to several dozen times in other posts so...
November 14, 2009 at 2:06 pm
Sorry to interrupt with a different subject:
It looks like the RAQ Report promoter is back (he/she must have been too busy over the last month ;-)).
If you...
November 14, 2009 at 8:39 am
SQL Server does exactly what you told to do:
update #TempTotalTable
set NoOfCol = NoOfCol
from #ColumnPerTable
where #TempTotalTable.TBName = #ColumnPerTable.TBName
This basically means to update NoOfCol with its original values, resulting in a unchanged...
November 14, 2009 at 8:23 am
Attached please find a sample code.
Some notes:
If you already have a unique value (like an ID) assigned to each row, the first CTE can be omitted.
Also, if you can guarantee,...
November 14, 2009 at 8:05 am
I think if you need somebody to work on more than (!!)1100(!!) lines of code, you should get a consultant in to help you.
If you'd like us to help you...
November 14, 2009 at 5:14 am
Would you please provide a (few) sample line(s) and your expected result?
Would make it easier for some of than talking plain theory...
November 14, 2009 at 4:25 am
Peter Brinkhaus (11/13/2009)
November 13, 2009 at 1:46 pm
Is there any specific reason to make the table name colum wider than it ever can get and at the same time making the DBname smalller than it might get?
I...
November 13, 2009 at 1:00 pm
GSquared (11/13/2009)
If you can't trust your DBAs with the data, for whatever reason, then you need to encrypt it. It's as simple as that.
It's nothing more than that. But...
November 13, 2009 at 12:45 pm
Just a tiny change to Peters excellent sample:
I moved the WHERE clause from the UNION ALL part to the outer part of the query.
Performance seems to be the same (query...
November 13, 2009 at 12:29 pm
Well, we're getting closer...
Following please find a proposal:
SET dateformat dmy
SELECT Emp_Id,
MAX(CASE
WHEN [Shift_Date] = '12/11/2009'
THEN ISNULL(Shift_Regular,'')
+ CASE
WHEN Shift_OnCall IS NOT NULL
THEN ' and ' +ISNULL(Shift_Regular,'')
ELSE...
November 13, 2009 at 12:12 pm
Seems like you have database and/or table names that are longer than the 50 char you defined for your temp table.
As per BOL
database_name can be a maximum of 128 characters
table_name...
November 13, 2009 at 10:44 am
I wonder why you focus on not having that bookmark lookup - there might be other ways to help performance, too...
Example:
What is the reason to do a sum aggregation over...
November 13, 2009 at 10:34 am
Viewing 15 posts - 4,771 through 4,785 (of 5,504 total)