Viewing 15 posts - 49,111 through 49,125 (of 49,552 total)
In theory
CREATE PROCEDURE TestOutput (
@InputParameter INT
@OutputParameter INT OUTPUT
)
AS
.....
DECLARE @Result INT
EXEC TestOutput @InputParameter = 1, @OutputParameter = @Result OUTPUT
Note the OUTPUT keyword, both when creating the stored proc and wne...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
May 17, 2006 at 2:00 am
and statistics cannot be mintained on them, so the optimiser has little to no idea how many rows are in the table variable when it generates a query plan.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
May 12, 2006 at 3:31 am
If you are going to be doing this kind of query, create a linked server and map the windows authenticated logins on one to a sql authenticated login on the...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
May 11, 2006 at 3:42 am
Cursors, especially nested cursors are not going to work very well, ever. I suggest a set-based solution.
This isn't a complete solution, but should give you a good idea where to...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
May 11, 2006 at 2:55 am
IF EXISTS(SELECT 1 FROM mytable)
RAISERROR (...)
No need for variables or anything.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
May 10, 2006 at 12:35 am
I usually use this when I'm optimising queries.
set
statistics io on
set statistics time on
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We stand on the bridge and no one may pass
May 4, 2006 at 5:53 am
From books online
status | int | Status bits for the growth value in either megabytes (MB) or kilobytes (KB). 0x2 = Disk file. 0x40 = Log file. 0x100000 = Growth. This... |
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
May 2, 2006 at 4:17 am
I tend to use this one. Not sure if it's the best, but it is way better than the usual cast as varchar version. Haven't seen any strange issues
SELECT CAST(FLOOR(CAST(GETDATE()...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 28, 2006 at 12:08 am
What does this return?
DECLARE @val VARCHAR(50)
SELECT name from dbo.sysobjects where OBJECTPROPERTY(id, N'IsConstraint') = 1 AND name like 'PK__TestTable%'
select @val = name from dbo.sysobjects where OBJECTPROPERTY(id, N'IsConstraint') = 1 AND name...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 21, 2006 at 3:56 am
If you print the string instead of executing it, what does it contain?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 21, 2006 at 3:28 am
You'll need to use dynamic SQL in this case, as an alter table can't take a variable.
DECLARE @val VARCHAR(50)
select @val = name from dbo.sysobjects where OBJECTPROPERTY(id, N'IsConstraint') = 1 AND...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 21, 2006 at 1:51 am
Easiest, yes, fastest, no.
Using a function on a column in the where clause of a query will prevent the optimiser from using any index that may exist on that...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 21, 2006 at 1:48 am
What type is the TAB lock? S, X, IX, Sch-S?
An IX lock on table level is fairly normal when doing modifications. It's not a full exclusive lock, it's there in...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 20, 2006 at 12:35 am
I'd love to work in the 3D graphics industry. I do modelling and rendering as a hobby, but I'm no where near as good as the professionals
That, or be an...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 19, 2006 at 4:09 am
Table A to be able to create 1 row for each distinct gr# with first occurence of toname and fromname
What do you mean by first? First alphabetically? Is there another...
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 13, 2006 at 2:48 am
Viewing 15 posts - 49,111 through 49,125 (of 49,552 total)