Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Query has syntax error but compiles anyway

Author  Topic 

SQL_Stinger
Starting Member

40 Posts

Posted - 2001-02-20 : 13:50:13
I ran across an issue today that has me worried. I have the following stored procedure. This procedure compiles just fine, but notice that there is a missing comma after UserStatusID. When executed, the results show all columns except UserStatusID including ActiveFlag.

Is this a bug in SQL Server? Why is such an obvious syntax error not being caught when the query is compiled?

CREATE PROC spGetUserInfo
@vchrUserName varchar(20)
AS
BEGIN
SELECT UserID,
UserName,
UserTypeID,
UserPassword,
PasswordExpires,
PersonID,
NumberOfAttempts,
UserStatusID
ActiveFlag
FROM TblUsers
WHERE UserName = @vchrUserName
END




--------------------
SQL Stinger
   

- Advertisement -