Viewing 15 posts - 21,256 through 21,270 (of 22,224 total)
You have to understand, BOL is my best friend because I'm too darned stupid to remember stuff.
"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
January 15, 2008 at 8:28 am
Oh, that's likely to be a bit tougher then. I'm not sure how you'd do this in 7.0 (haven't touched it in years and years).
"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
January 15, 2008 at 7:12 am
Just note, it's 'sys.databases' not 'sysdatabases'. You need to get in the habit of looking at the catalog views, not the 2000 system tables.
"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
January 15, 2008 at 7:03 am
You can use parameters within sp_executesql. Those parameters can be output parameters. You can set those values within the ad hoc query and output them from there and then set...
"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
January 15, 2008 at 7:00 am
Probably a completely inadequate solution... but I wanted a little experiment this morning:
CREATE TABLE #DBList(DBName NVARCHAR(100))
DECLARE @Tablename NVARCHAR(100)
DECLARE @Tsql NVARCHAR(MAX)
DECLARE @DBName NVARCHAR(100)
DECLARE Cur CURSOR FOR
SELECT NAME
FROM [sys].databases;
SET @Tablename =...
"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
January 15, 2008 at 6:52 am
I got them, but both were tagged as potential spam by our filter. Maybe that's where yours are?
"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
January 15, 2008 at 6:11 am
AND, can't believe I forgot this, you need to look at the selectivity of the data in those columns to be sure an index will work well.
"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
January 14, 2008 at 12:28 pm
First question I'd ask is, what are the additional search criteria? That will affect the index. Also, do you have clustered indexes already on these tables? If so, what columns?...
"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
January 14, 2008 at 12:27 pm
From BOL:
Avoid using float or real columns in WHERE clause search conditions, especially the = and <> operators. It is best to limit float and real columns to > or...
"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
January 14, 2008 at 12:19 pm
The problem with floats is that they are imprecise, by definition.
Sorry about the bit of misdirection. I used it against a decimal several times with no issue. Works well in...
"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
January 14, 2008 at 11:58 am
Yes, you need to add wild cards. Instead of simply
LIKE '42'
make it instead
LIKE '42%'
"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
January 14, 2008 at 11:21 am
There are a number of third party tools that can do this, for example Embarcadero's RapidSQL. You can also simply right click on the tables and get it for yourself....
"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
January 14, 2008 at 11:17 am
Yes, that's exactly the type of auditing function that I had understood the OUTPUT function to be useful for. I just hadn't made the leap to using it with 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
January 14, 2008 at 8:21 am
Here we have a double edged sword. On the one side, I've got a more effecient tool to use in my queries. On the other side, you just handed me...
"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
January 14, 2008 at 8:12 am
I knew of the OUTPUT clause, but I'd only really thought of it for stuff like auditing. This is really useful. So, if you had a multi-row insert, you'd just...
"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
January 14, 2008 at 7:43 am
Viewing 15 posts - 21,256 through 21,270 (of 22,224 total)