Search code examples
sql-server-2000

Local temporary tables fail on SQL Server 2000


I am just trying to implement the following code sample on our SQL Server 2000 database: http://support.microsoft.com/default.aspx?scid=kb;en-us;q248915

The problem appears when I try and create the "expand" stored procedure which produces the following errors:

Error code 156, SQL state S1000: Incorrect syntax near the keyword 'INSERT'.
Error code 156, SQL state S1000: Incorrect syntax near the keyword 'BEGIN'.
Error code 156, SQL state S1000: Incorrect syntax near the keyword 'WHERE'.
Error code 156, SQL state S1000: Incorrect syntax near the keyword 'WHERE'.
Error code 156, SQL state S1000: Incorrect syntax near the keyword 'ELSE'.

It appears that I can't create local temporary tables as the following SQL demonstrates:

CREATE TABLE #Yaks (YakID int,YakName char(30))

Error code 170, SQL state 37000: Line 1: Incorrect syntax near 'TABLE'.

Does anybody have any idea why I can't create temporary tables? Especially when article says the code applies to Microsoft SQL Server 2000.

Thanks

UPDATE: It appears this might be an issue with NetBeans SQL Editor as the query works fine when used within SQL Server Query Analyser.


Solution

  • Turns out it was a bug within NetBeans itself, which has now been resolved:

    http://netbeans.org/bugzilla/show_bug.cgi?id=222617