Viewing 15 posts - 91 through 105 (of 1,346 total)
A CTE declaration can only be used once, so if you need to SELECT out of the CTE#1 *and* then re-use it in a subsequent CTE, maybe you'd be better...
November 14, 2007 at 12:01 pm
Are any of the non-clustered indexes perhaps better candidates for being clustered ?
Do any of them have some naturally ascending type of data in them, eg dates.
November 14, 2007 at 11:59 am
Example here:
http://msdn2.microsoft.com/en-us/library/ms186243.aspx
CTE has an "anchor" statement, UNION'ed with another SELECT that references the CTE.
November 14, 2007 at 11:49 am
Ahh, it wasn't clear that it was 400K records into an existing very large table. I thought it was creation of a new table with an initial 400K records.
OK, so...
November 14, 2007 at 11:15 am
>>Which table do you mean when you "inserted table"? The table I'm inserting into, or inserting from?
The table being inserted to.
Can you remove the indexes and primary key constraint prior...
November 14, 2007 at 11:00 am
Things to consider:
Are there any triggers on the table being inserted ?
Is there a clustered index on the inserted table and does the clustered index include the GUID column ?
How...
November 14, 2007 at 10:31 am
Try running DBCC UDPATEUSAGE() on the database to ensure the system cataolog tables are up to date.
Also, have you applied service pack 1 or 2 yet ? There was a...
November 13, 2007 at 1:57 pm
Looks to me like all 4 SELECTs are exactly the same, with just a different filter on T_HISTORY.ORIG_DT based on the input parameters.
Do you really need IF .. THEN blocks...
November 13, 2007 at 9:20 am
It wasn't an entirely fair comparison, because I hard-coded the ROW_NUMBER() solution to use TOP 100.
I'd expect the CTE to win out for smallish values of "EngCount" because it only...
November 8, 2007 at 10:11 am
Hey, all it took was 1 cup of coffee:
[font="Courier New"]With CTE_Expand
As
(
Select CustomerID, EngID, 1 As EngNumber
From @Table
Union All
Select c.CustomerID, c.EngID,...
November 8, 2007 at 9:48 am
Nice 🙂
Don't forget, though, in SQL2005 we don't need to use permanent tables and IDENTITY columns to generate our numbers for us. Use ROW_NUMBER() function and a derived table on...
November 8, 2007 at 9:42 am
Microsoft KB article on the subject:
http://support.microsoft.com/kb/906344
Nothing to be concerned about.
October 23, 2007 at 9:46 am
Looping and inserting 1 record at a time is never going to give you the performance you require.
I would revert to bulk insert to a staging table, and then remap...
September 19, 2007 at 11:18 am
Cue gnashing of teeth ...
The columns PART_ID DATE PART_CD REN_CD are part of PK
But, but ... if PART_CD is part of the key, then in the example you...
March 23, 2007 at 2:00 pm
Viewing 15 posts - 91 through 105 (of 1,346 total)