Viewing 15 posts - 21,106 through 21,120 (of 22,219 total)
Did you mean to post this in the 2008 forum? If so, I tested your script on a 2008 database and it ran just fine. I'm not sure where the...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 4, 2008 at 11:15 am
I found Itzik Ben Gan's course on advanced TSQL very helpful. He covered all the new TSQL functionality in great depth. He's from Solid Quality Mentors.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 4, 2008 at 9:02 am
Have you performance tested both approaches? I think the CTE approach, especially the second one, not mine, should be much more effecient than loading data into a temp table.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 4, 2008 at 8:29 am
Automatic verification of changes to the scripts as you save them is a pretty large advantage. Refactoring object names is great. The Static Code Analysis is getting a lot more...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 4, 2008 at 6:19 am
If you can pass the data in as XML, you can use the XQUERY language in 2005 to pull the data out of it, exactly like a table. It looks...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 4, 2008 at 4:51 am
Most of the time, cursors just flat out run too slow. Rewriting the procedures to avoid the use of cursors is usually the best bet. Other than that, I'm not...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 4, 2008 at 4:43 am
This white paper from Microsoft is one of the best sources for this information.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 4, 2008 at 4:38 am
Itzik is the greatest.
It sounds as if you're doing some sort of data migration. If you can, you should look into, in some way, turning this into a bulk load....
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 4, 2008 at 4:35 am
The long answer is: it depends.
Let's assume that the 8 column table is supposed to be retained in it's entirety and that you're supposed to create that, load it, and...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 4, 2008 at 4:28 am
As you've already seen, no they're not both the same. Yes, the number of physical reads is the same, but you'll find that this procedure recompiles, a lot, probably every...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 4, 2008 at 4:21 am
How about using a CTE within a UNION query. Something like this:
WITH MyCTE AS
(SELECT SalesOrderId
,row_number() over (order by TotalDue DESC) AS TotalRank
,TotalDue
FROM Sales.SalesOrderHeader)
SELECT TOP 5 *
FROM MyCTE
UNION
SELECT *
FROM MyCTE
WHERE SalesOrderId...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 4, 2008 at 4:13 am
This seriously sounds like a highly questionable approach.
However, if you really want to do it, you need to use dynamic SQL:
DECLARE @mySQL nvarchar(max)
SET @mySQL = 'SELECT ' + @Column...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 1, 2008 at 12:31 pm
But if you were using SMO as a code generation utility, it wouldn't matter that you had to use the name would it? I mean if we assume that you...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 1, 2008 at 12:26 pm
I've done it both ways. The one recommendation I can make is to make this consistent with the rest of the system. If the system is using artificial and invisible...
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 1, 2008 at 11:48 am
I'm sorry. I really don't know at this point. We use this all the time and it works just fine.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
February 1, 2008 at 10:12 am
Viewing 15 posts - 21,106 through 21,120 (of 22,219 total)