This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 222617

Summary: The '#' character used for temporary tables creates an error for MS SQL Server
Product: db Reporter: SCHOLARgraeme
Component: SQL EditorAssignee: Jaroslav Havlin <jhavlin>
Status: RESOLVED FIXED    
Severity: normal CC: SCHOLARgraeme
Priority: P3    
Version: 7.2   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description SCHOLARgraeme 2012-11-22 17:27:09 UTC
The # character is used to create temporary tables in MS SQL Server. However, the SQL Editor returns an error when the following SQL Query is used:

CREATE TABLE #Yaks (YakID int,YakName char(30))
Error code 170, SQL state 37000: Line 1: Incorrect syntax near 'TABLE'.
Line 1, column 1

When using that same command else where e.g. in Java Code or in the MS SQL Query Analyzer it works fine without an error being given.

Tested with the Microsoft SQL JDBC driver 1.2.5


Product Version: NetBeans IDE 7.2 (Build 201207171143)
Updates: Updates available
Java: 1.7.0_05; Java HotSpot(TM) Client VM 23.1-b03
System: Windows 7 version 6.1 running on x86; Cp1252; en_GB (nb)
User directory: C:\Users\gk85\AppData\Roaming\NetBeans\7.2
Cache directory: C:\Users\gk85\AppData\Local\NetBeans\Cache\7.2
Comment 1 Jaroslav Havlin 2012-11-23 11:57:50 UTC
http://hg.netbeans.org/core-main/rev/aeec33367fb4

The problem is that the # character is used by MySQL for line comments, so part of the statement was removed.
Now the type of database is checked to decide whether # comments should be supported.
Thank you for reporting.
Comment 2 Quality Engineering 2012-11-24 13:05:33 UTC
Integrated into 'main-golden', will be available in build *201211240959* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/aeec33367fb4
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #222617: The '#' character used for temporary tables creates an error for MS SQL Server
Comment 3 SCHOLARgraeme 2012-11-27 17:51:46 UTC
Thanks, I can confirm that the issue has now been resolved at my end:

CREATE TABLE #Yaks (YakID int,YakName char(30))
Executed successfully in 0 s.
Line 1, column 1

Execution finished after 0 s, 0 error(s) occurred.