FIX: EXECUTE Command w/ a Local Variable Can Cause Thread AVID: Q132345
|
Invalid syntax when you build an EXECUTE statement from a local
variable can cause a thread access violation (AV).
The access violation can be generated when Microsoft SQL Server version 6.0
attempts to resolve a stored procedure name that was built in a declared
variable. SQL Server generates a thread access violation and aborts the
connection.
The error occurs when the EXECUTE statement treats an oversized buffer
(more then 30 characters) as a stored procedure name instead of as a
specific Transact-SQL command due to the use of invalid syntax for the
EXECUTE statement itself.
For example:
use pubs
go
declare @strCommand char(128)
select @strCommand = 'select * from authors'
execute @strCommand
go
DECLARATION BEHAVIOR
----------- ---------
varchar(xxx) Successful completion of command, or appropriate error
returned:
'Unable to find stored procedure 'select * from authors'
char(30) Successful completion of command, or appropriate error
returned:
'Unable to find stored procedure 'select * from authors'
char(128) Thread access violation.
Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.0. This problem was corrected in Service Pack 1 for SQL Server version 6.0. For more information, contact your primary support provider.
Additional query words: sql6 Windows NT
Keywords : kbother kbbug6.00 kbfix6.00.sp1 SSrvWinNT
Version : 6.0
Platform : WINDOWS
Issue type :
Last Reviewed: April 21, 1999