Viewing 15 posts - 5,596 through 5,610 (of 10,144 total)
There are solutions using a nested select, but I think this should be simpler:
SELECT
matters.clientID as Client_Code,
Number,
description as Matter_Description,
matters.representative as Rep,
matters.mattertype as Matter_type,
chargetyperef as Charge_Type,
UFN,...
September 21, 2012 at 9:41 am
Michael Valentine Jones (9/21/2012)
kingdonshel (9/21/2012)
September 21, 2012 at 8:59 am
There's a cautionary note in the CREATE SCHEMA section of BOL;
"Beginning with SQL Server 2005, the behavior of schemas changed. As a result, code that assumes that schemas are equivalent...
September 21, 2012 at 8:34 am
Can you post the CREATE INDEX script?
If you're updating the whole table, then nonclustered indexes won't help performance and will impede performance if they too require updating.
Batching the update could...
September 21, 2012 at 8:25 am
Big hammer;
DECLARE @asd VARCHAR(20)
SET @asd = 'asdaaaadffa'
SELECT
Letter,
Occurrences = COUNT(*)
FROM (
SELECT Letter = SUBSTRING(@asd,n,1)
FROM (SELECT TOP(LEN(@asd)) n = ROW_NUMBER() OVER (ORDER BY (SELECT NULL))
FROM sys.all_columns) tally
) d
GROUP BY Letter
ORDER...
September 21, 2012 at 7:25 am
UPDATE StoreProducts SET Stock = Stock + 2
UPDATE ProdutStorages SET Stock = Stock + 2
How many tables are you updating?
September 21, 2012 at 7:16 am
dwain.c (9/21/2012)
egerencher (9/21/2012)
September 21, 2012 at 4:42 am
Hunterwood (9/21/2012)
Thanks Chris,I was too quick and missed the inner group by, which is the most likely to give the error...
/Markus
Hey Markus, no problem - it's always good to have...
September 21, 2012 at 3:00 am
hoseam (9/21/2012)
I have this query
SELECT
(select REB_TAX_RATE from PR_REB_TAX_RATE
where EFF_DATE = (select MAX(EFF_DATE)
...
September 21, 2012 at 2:18 am
dwain.c (9/20/2012)
....But one of those SSNs shouldn't be there!
Gah! I hate it when that happens. Here's a new, completely different version;
;WITH
MyTrans AS (
SELECT TransID,...
September 20, 2012 at 9:50 am
dwain.c (9/20/2012)
...I knew someone would come along that knew what they were doing and best me. 😀
Haha! I had no idea that this query would be any faster when I...
September 20, 2012 at 4:45 am
Note that the date arithmetic is still messed up - but I'm bored with making corrections to it because you keep throwing them away. The date arithmetic I posted was...
September 20, 2012 at 4:39 am
chinye2020 (9/20/2012)
ChrisM@Work (9/20/2012)
chinye2020 (9/19/2012)
...No,Chris, When the Acc No's Open_balance is null Between the date only change the sql query to before 16-09-12...
how to do that?
Use ISNULL or COALESCE in the...
September 20, 2012 at 3:34 am
laurie-789651 (9/20/2012)
ChrisM@Work (9/19/2012)
September 20, 2012 at 3:30 am
Simpler, quicker, same results:
SELECT
t.TransID,
c.SSN,
t.TransDate,
t.Amount
FROM #Customer c
INNER JOIN #TransDtl t
ON t.CustKey = c.CustKey
CROSS APPLY (
SELECT Amount = SUM(ti.Amount)
FROM #TransDtl ti
WHERE t.CustKey = c.CustKey
AND ti.TransDate BETWEEN t.TransDate-1 AND...
September 20, 2012 at 2:59 am
Viewing 15 posts - 5,596 through 5,610 (of 10,144 total)