Viewing 15 posts - 916 through 930 (of 3,957 total)
Sean Lange (1/13/2014)
Of course let's not forget to include the cleanup to drop our temp tables.
drop table #DEMOGRAPHICS
drop table #CHARTATTACHMENT
drop table #NOTES_TEXTDATA
This is awesome advice. Is that in the...
January 13, 2014 at 11:33 pm
rajashreesql2014 (1/13/2014)
Note : I tried sum but since the type is varchar .. I am getting an error.
Did you try using MAX? That works with VARCHARs.
I agree that you...
January 13, 2014 at 11:26 pm
While Sean and Lowell are essentially correct in their suggestions that there's probably a better way to structure your tables to handle the tax consequences of an invoice, I have...
January 12, 2014 at 7:12 pm
Sharon,
I think you've been around long enough to know that you get better help by posting DDL and consumable sample data. But I'm feeling generous on this Monday morning...
January 12, 2014 at 6:47 pm
Are you looking for something like this?
SELECT RowID=ROW_NUMBER() OVER (ORDER BY AccountID, RandomDate)
,AccountID, RandomDate, NextDate, LeadInMonths
,RankForThisLeadInMonths=SUM(lm) OVER
...
January 12, 2014 at 6:25 pm
You can also use a pattern-based string splitter like PatternSplitCM, which can be found in the 4th article in my signature links.
WITH SampleData (MixedStr) AS
(
SELECT '1234heaven56-guy'
),
...
January 12, 2014 at 5:47 pm
This query will get you the output you requested but I'm sure it is way over-simplified.
SELECT invoice_no
,item_no=MAX(CASE WHEN item_type <> 'K' THEN item_no END)
...
January 12, 2014 at 5:37 pm
Shanmuga Raj (1/9/2014)
dwain.c (1/9/2014)
WITH rCTE AS
(
SELECT b.Mode_ID, b.Mode_info, Mode_Detail=Mode_info, QA, QC, QY, Mode_Sno, b.Has_Nodes
FROM Travel_Quantity a
...
January 9, 2014 at 10:52 pm
JohnFTamburo (1/9/2014)
dwain.c (1/9/2014)
Something like this perhaps?SNIP
See! You gave him the entire solution! 😀 :w00t:
Not really. The results set is close but not exact, which means he'll need to...
January 9, 2014 at 6:58 pm
Luis Cazares (1/9/2014)
SELECT a.invoic_no, a.item_no
,Sales= CASE WHEN item1 = a.item_no THEN a.invoic_qty ELSE 0 END
...
January 9, 2014 at 6:21 pm
Something like this perhaps?
WITH rCTE AS
(
SELECT b.Mode_ID, b.Mode_info, Mode_Detail=Mode_info, QA, QC, QY, Mode_Sno, b.Has_Nodes
FROM Travel_Quantity a
JOIN Travel_Master b...
January 9, 2014 at 6:18 pm
Using Dohsan's sample data, here is another solution that should work in SQL 2000 that is a bit more concise:
SELECT a.invoic_no, a.item_no
,Sales=CASE WHEN item1 =...
January 9, 2014 at 5:45 pm
Phil Parkin (1/8/2014)
January 8, 2014 at 11:21 pm
thava (1/8/2014)
how about this one
SELECT @Result = NULL;
-- Option 6:
SELECT @Result = CASE
WHEN @aa =@XXX AND @XXXCount...
January 8, 2014 at 10:48 pm
Phil Parkin (1/7/2014)
January 8, 2014 at 6:08 pm
Viewing 15 posts - 916 through 930 (of 3,957 total)