Viewing 15 posts - 4,366 through 4,380 (of 10,144 total)
daniness (7/17/2013)
Actually, originally the group by was part of the 1st subquery, but it wasn't working, so this is why I tried placing it at the end, but obviously...
July 17, 2013 at 7:26 am
Not really. Like this:
CREATE TABLE #SAMPLE (MyString VARCHAR(200))
INSERT INTO #SAMPLE (MyString)
SELECT 'A whole string from my table' UNION ALL
SELECT 'A second whole string from my table' UNION ALL
SELECT 'A third...
July 17, 2013 at 7:23 am
sqlnes (7/17/2013)
2 index scans are unavoidable?
That's correct. You can have an index scan too if you want - just up the ratio of looked-up rows to parent rows, but you're...
July 17, 2013 at 7:18 am
You won't get the two queries to JOIN in the way that you are attempting to, unless each query works in isolation. The second query has aggregate functions but there's...
July 17, 2013 at 7:13 am
Can you post a dozen or so sample strings please Joe? Cheers.
July 17, 2013 at 7:03 am
sqlnes (7/17/2013)
Thank you Gail & Chris for explain.Just checked my tables and the "col1" on both table are non null. So it seems it's unavoidable.
What's unavoidable? (Apart from D...
July 17, 2013 at 6:31 am
sqlnes (7/17/2013)
select * from A where col1 not in (select col1 from...
July 17, 2013 at 4:42 am
HanShi (7/17/2013)
Could you rewrite the delete statement to:
DELETE TOP (20) FROM [dbo].[ServerParametersInstance]WHERE Expiration < @now
This will prevent the query to simultaneously read and delete from the same table.
SQL Server...
July 17, 2013 at 3:06 am
APPLY simplifies this query nicely;
SELECT
b.VINTAGE,
x.DaysDiff,
b.CR_SCR_BAND,
x.ME_DQ,
count(a.account),
[BALANCE] = sum(a.currtotalbal-a.CurrDisc)
FROM dbo.ME_MASTER a
LEFT JOIN #temp b
on a.ACCOUNT = b.ACCOUNT
CROSS APPLY (
SELECT
[ME_DQ] = CASE
when a.DAYSPD <...
July 17, 2013 at 2:12 am
riya_dave (7/16/2013)
i need to move data to another table and then remove from old one ,which i needs to delete 30 millions of rows,
i know its taking time but any...
July 17, 2013 at 1:40 am
@Erin, yes, and it's not limited to a single statement. One such pass-thru command in the system I'm currently working on contains several INSERT and UPDATE statements protected by a...
July 17, 2013 at 1:10 am
You might get some mileage out of this:
DECLARE @SQLTruncate VARCHAR(200)
SET @SQLTruncate = 'TRUNCATE TABLE ' + @schema + '.' + @tablename
EXECUTE(@SQLTruncate) AT LinkedServerName -- no quotes around linkedservername
July 16, 2013 at 9:39 am
SQL Show (7/16/2013)
July 16, 2013 at 6:28 am
-- "upsert"
UPDATE GNL_OgretmenDevamsizlikGirisLog SET
recordtime = CASE WHEN recordtime IS NULL THEN @Newtime ELSE recordtime END,
updatedtime = CASE WHEN recordtime IS NULL THEN updatedtime ELSE @Newtime END
WHERE OgretmenID = @ogretmenID
AND DersYiliID...
July 16, 2013 at 2:59 am
Change the order of the keys - this should give you seeks on [status];
CREATE NONCLUSTERED INDEX [IX_VIEW_IP21] ON [dbo].[RESULT]
(
[STATUS] ASC,
[SAMPLE_NUMBER] ASC,
[ANALYSIS] ASC
)
INCLUDE ( [UNITS],
[NAME],
[NUMERIC_ENTRY]) WITH (PAD_INDEX = OFF,...
July 15, 2013 at 6:08 am
Viewing 15 posts - 4,366 through 4,380 (of 10,144 total)