Viewing 15 posts - 3,106 through 3,120 (of 5,502 total)
I think the following solution will cover all scenarios:
DECLARE @ProductID INT
DECLARE @Runbalance INT
DECLARE @StockDays INT
DECLARE @RunningBalance INT
UPDATE [dbo].[temp_AVDays]
SET
@runbalance = runbalance...
July 19, 2010 at 1:41 pm
Paul White NZ (7/19/2010)
...I do use table variables quite a lot, but each has its own advantages and disadvantages, as Wayne clearly shows in his article.
Paul
Absolutely agreed.
And based on...
July 19, 2010 at 10:25 am
Sagar Sawant (7/19/2010)
I have applied necessary changes in query.
If I removed below code from sql query then query executed in 2 seconds.
,str_SourceID=STUFF(( SELECT ','+ str_SourceOfData FROM tbl_MARC_MemberSourceData MSD,tbl_MARC_SourceMaster SM
WHERE...
July 19, 2010 at 10:19 am
Like I stated in my first post: It depends on the requirement.
You cannot use DATEPART() if you need to get the week as per ISO specification.
Furthermore, DATEPART(WEEK,somedate) will return different...
July 19, 2010 at 10:16 am
I think the solution I posted will not cover all scenarios (e.g. if the 2nd or 3rd ProductID will have a stock less than the amount received last).
I'll have a...
July 19, 2010 at 10:03 am
gah (7/18/2010)
gah (7/18/2010)
...Guys...anyone care to help me out on Lutz's #1...seem to be strugglng at the mo
any ideas most appreciated...thanks
Graham
????
I'm kinda confused...
The code I provided include the following line:
ELSE ISNULL(@RunningBalance,Current_Stock)...
July 18, 2010 at 3:12 pm
Hi gah,
GREAT JOB!!!!
As far as I can see, this solution will work.
I would make two changes:
#1: you need to cover the scenario where your stock is less than the amount...
July 18, 2010 at 9:32 am
Your c.u.r.s.o.r (*cough*) suffers the same problem David and myself were talking about: there is absolutely no guarantee to get the rows back in the same order as the rows...
July 18, 2010 at 7:32 am
Several things:
#1: 2 seconds and 1.36 seconds, respectively, are both below your target of 5 seconds 😀
#2: instead of using a table variable you should use an indexed...
July 18, 2010 at 3:04 am
What would be your expected result other than what you already have?
Isn't the result already what you're looking for?
July 17, 2010 at 9:12 am
Yes, it's possible.
Have a look at "GROUP BY".
July 17, 2010 at 8:11 am
duplicate post.
Discussion alread started here.
@scottichrosaviakosmos
Is there any specific reason for starting a separate thread with an identical subject instead of simply answering the question I asked?
July 17, 2010 at 4:26 am
(o_0) (7/10/2010)
thanks for the replies guys.they were very helpful. 🙂
any idea which is more efficient to use?
nodes method or openxml?
since both of them have the same output.
just curious though..
I did...
July 17, 2010 at 2:45 am
It's not clear to me what you're looking for.
What rows do you want to return?
Simple scenario:
col1col2
A11
A12
A23
A24
What would be your expected output?
July 17, 2010 at 2:34 am
There are several concepts depending on what type week number you're looking for.
If you need the week numbered as per the restrictions described in BOL (BooksOnLine, the SQL Server help...
July 17, 2010 at 2:17 am
Viewing 15 posts - 3,106 through 3,120 (of 5,502 total)