Viewing 15 posts - 4,816 through 4,830 (of 5,843 total)
Peter, I couldn't really follow the code you had. Was it supposed to be just separate batch files or was some/all of it supposed to be wrapped up in...
January 8, 2009 at 7:33 am
Which is why I was saying it should be decompiled down to it's logical equivalent, which will do the right thing:
create table #t (fname varchar(20))
insert #t (fname)
select top 100 'asdf'
from...
January 7, 2009 at 2:30 pm
phystech (1/7/2009)
TheSQLGuru (1/7/2009)
...If you never passed in a NULL value then the CASE is surperfluous, right?..
No, zero length string plays the role of NULL. That is if the...
January 7, 2009 at 12:53 pm
I've been using the approach within rather complex query for some months. And my strong impression is that the short-circuiting works. Though I don't short-circuit it on NULL value, I...
January 7, 2009 at 11:14 am
phystech (1/6/2009)
Adam Haines (1/6/2009)
WHERE CASE
WHEN @FirstName IS NOT NULL THEN
CASE WHEN FirstName = @FirstName THEN 1
...
January 7, 2009 at 9:09 am
Here is an example I slapped together just yesterday on another thread that shows how bad table vars can be for even very FEW rows in them. Here is...
January 7, 2009 at 9:03 am
Tom.Thomson (1/6/2009)
TheSQLGuru (1/6/2009)
.... here is a quickie example. as the number of rows (or joins) goes up it gets much worse
....
This example may be rather misleading, depending...
January 6, 2009 at 2:40 pm
Matt Whitfield (1/6/2009)
Temp table: 1.218
Table variable: 0.921
I think probably what you wanted me to do instead was to change the 100 to 1000. Then it moves heavily...
January 6, 2009 at 10:37 am
Classic problem of using table valued functions: the optimizer can't get the estimations right. Note that nested loop plans are chosen because the estimation is very low (130...
January 6, 2009 at 9:37 am
2 points to add:
1) If you are going with dynamic sql, the go completely with it. Constructs such as this:
...
January 6, 2009 at 9:29 am
Matt, can you please run your last example without the PK clustered?
January 6, 2009 at 9:16 am
1) you cannot have a regular old non-unique/nonPK index on a table variable
2) you can do this however to create a multiple column PK:
declare @tab table (a tinyint, b tinyint,...
January 6, 2009 at 8:02 am
There is definitely one situation where table vars help - high-volumn sproc calls where recompiles kill performance. Those are pretty rare situations but they do exist.
January 5, 2009 at 7:52 pm
Matt Whitfield (1/5/2009)
Farrell Keough (1/5/2009)
...as you cannot Index a @TableVariable...
I thought that until Jeff Moden set me straight. You can declare a table variable like this
declare @myTable TABLE (ID INT...
January 5, 2009 at 4:13 pm
I will go on record saying that in my book this is a situation where a cursor is perfectly acceptable if not preferred.
January 5, 2009 at 9:24 am
Viewing 15 posts - 4,816 through 4,830 (of 5,843 total)