Viewing 15 posts - 19,261 through 19,275 (of 22,226 total)
Wow! Thanks!
You're very welcome.
Lookup information on sys.dm_exec_cached_plans and some of the other dynamic management views. I left that out and wish I had it in there now.
Do what Steve says....
"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
November 25, 2008 at 9:52 am
Wow, I really misunderstood then. I thought you were going for the most frequent occurence.
Well then, here's one more suggestion. In the sub-query, replace the MAX with a TOP 1...
"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
November 25, 2008 at 9:45 am
kalikal (11/25/2008)
I had to make a slight change but it now works - thank you for taking the trouble to help.
WITH X AS (SELECT ...
"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
November 25, 2008 at 9:15 am
Books Online are available on line here:
http://msdn.microsoft.com/en-us/library/ms130214.aspx
The OUTPUT clause that you want is here (this in the 2008 version, but it's the same):
http://msdn.microsoft.com/en-us/library/ms177564.aspx
Here is an article describing the OUTPUT clause:
http://blogs.msdn.com/sqltips/archive/2005/06/13/OUTPUT_clause.aspx
@@IDENTITY...
"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
November 25, 2008 at 8:30 am
Yes, it is possible through SSIS.
"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
November 25, 2008 at 8:22 am
Oh, that's a different problem. I got you a max for the unique combination of values. Just to get a max for each ProductId drop the second sub-select in 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
November 25, 2008 at 8:17 am
I've never thought about automating it before. I took a quick look at what happens in Profiler when I script a database. It must be an SMO call from Management...
"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
November 25, 2008 at 6:49 am
kalikal (11/25/2008)
So from the table below I want
ProductID UnitID
1 ...
"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
November 25, 2008 at 6:37 am
I gave him the answer.... Yes
"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
November 25, 2008 at 6:11 am
Yes, SSIS or BCP can both work with semi-structured data.
"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
November 25, 2008 at 6:11 am
From the information you've given, you must have more than one row that meets the criteria defined. It's the only way you would get the problem.
"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
November 25, 2008 at 6:04 am
The question intrigued me, so I played with until I got the right answer. I've no doubt (at all) that there are more efficient ways to work this, but this...
"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
November 25, 2008 at 5:59 am
Take a look at the Books Online for the topic OUTPUT clause. That's exactly what you need. It can work with a single row insert, or with batches, and captures...
"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
November 25, 2008 at 5:33 am
A "self Join" is when a single table is joined back to itself. You have two tables.
Can you better define what it is you're trying to do?
"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
November 25, 2008 at 5:31 am
You can only run it once for a particular set of values, yeah.
Here, an example:
CREATE TABLE dbo.x
(ColNo1 INT NOT NULL,
ColNo2 INT NOT NULL,
Val VARCHAR(50) NULL)
ALTER TABLE dbo.x ADD CONSTRAINT...
"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
November 24, 2008 at 1:23 pm
Viewing 15 posts - 19,261 through 19,275 (of 22,226 total)