Viewing 15 posts - 106 through 120 (of 1,824 total)
Hi Ahmad,
Investigate the COUNT aggregate function first. When comfortable with that , take a look at the PIVOT operator.
Personally i prefer to make the PIVOT'ing a frontend/disply issue...
February 26, 2012 at 4:17 am
Sounds to me like a solution using CDC (Change data capture) or CT (Change Tracking) used in conjuction with ssis would be a good alternative here.
January 26, 2012 at 12:05 am
Pivot will 'convert' rows to columns , un-pivot will go the other way columns to rows
This link contains some full examples
January 25, 2012 at 11:58 pm
Hi ,
I think you are going to have to go into a bit more detail about what you dont understand.
January 23, 2012 at 12:04 am
TimeToShine (1/19/2012)
January 19, 2012 at 11:58 pm
They are "Table Variables".
January 18, 2012 at 11:52 pm
Ok , so Brad says
"Another way to use Profiler is to monitor live,
production activity on a 24/7 basis. Wait just a moment. Did I just recommend using Profiler 24/7?
Isn't this...
January 18, 2012 at 3:28 pm
Hmmm , that is quite a convuluted mess.
Start by doing a proper join rather than sub-selects
so
FROM [NADECORP\SNjenga].ACTUAL_HDD_DAILY nolock
WHERE WEATHER_STATION =
(SELECT WEATHER_STATION FROM StagingVolume WHERE BillDate_ID = @intRowNo)
AND Market_ID =...
January 18, 2012 at 2:44 pm
Grant has done a good right up of the reasons why, http://www.scarydba.com/2008/12/18/profiler-research/
Given that there are easy and viable alternatives, I wouldnt want to take the risk with my production...
January 18, 2012 at 2:37 pm
So something like this ?
Create table #Cust
(
CustomerId integer
)
go
Create Table #Orders
(
OrderId integer,
CustomerId integer,
DueDate date)
go
insert into #Cust(CustomerId) values(1)
go
insert into #Orders(OrderId,CustomerId,DueDate)
values(1,1,'20120101')
insert into #Orders(OrderId,CustomerId,DueDate)
values(2,1,'20120201')
insert into #Orders(OrderId,CustomerId,DueDate)
values(2,1,'20120301')
go
select * from
#Cust Outer apply (Select top(1) #Orders.*
...
January 18, 2012 at 2:25 pm
Hmmm , that does sound slow. Could point to errors further down the stack ??
Tried setting up Instant File Initialization ? http://sqlblog.com/blogs/tibor_karaszi/archive/2009/03/09/do-you-have-instant-file-initialization.aspx
January 18, 2012 at 2:11 pm
Yes, the one-to-many is what you should be aiming for. Its always better to over-engineer than under-engineer.
January 18, 2012 at 2:08 pm
Try this article http://www.sqlservercentral.com/articles/Tally+Table/72993/ on how to split a comma delimeted string. Then its just a simple join.
January 18, 2012 at 2:04 pm
agreed sp_executesql should *always* be used. But quite why dynamic sql is even being used here is anyones guess 🙂
January 18, 2012 at 1:26 pm
Viewing 15 posts - 106 through 120 (of 1,824 total)