更新:奇怪的线索 - 如果我将table1更改为table3,它将在CF中运行。我想丢掉桌子会完全清除它。但不知何故,它是一个僵尸。怎么解决?
这是我对问题的重复"查询在Sql Server Management Studio中工作,但不在......"
此代码(复制和粘贴)在SSMS中有效,但在Coldfusion查询中无效。我明白了:
执行数据库查询时出错。
[Macromedia] [SQLServer JDBC驱动程序] [SQLServer]列名称无效' StudentID'。
SQL:
IF OBJECT_ID('tempdb.dbo.##table1') IS NOT NULL
DROP TABLE ##table1
CREATE TABLE ##table1
(
[RecordID] [integer] IDENTITY NOT NULL,
[StudentID] [varchar](15) NOT NULL,
[CourseNumber] [varchar](6) NOT NULL,
[CompDateTime] [datetime] NOT NULL,
[SystemInfo] [varchar](250) NULL,
[WriteTime] [datetime] default GETDATE() NULL,
PRIMARY KEY CLUSTERED
(
[StudentID], [CourseNumber], [CompDateTime]
)
);
INSERT INTO ##table1
(StudentID, CourseNumber, CompDateTime, SystemInfo, WriteTime)
VALUES ('aaa', '111', GETDATE(), 'yes', GETDATE()),
('bbb', '222', GETDATE(), 'yes', GETDATE()),
('ccc', '333', GETDATE(), 'yes', GETDATE())
select * from ##table1;
drop table ##table1
完整CF错误
发生错误 //hanford/data/sitedata/WBT/wbt-dev/RecordsCollector/records-collector.cfm: 第54行来自 //hanford/data/sitedata/WBT/wbt-dev/RecordsCollector/records-collector.cfm: 第1行来自 //hanford/data/sitedata/WBT/wbt-dev/RecordsCollector/records-collector.cfm: 第54行来自 //hanford/data/sitedata/WBT/wbt-dev/RecordsCollector/records-collector.cfm: 第1 52:53:54:55:56: IF OBJECT_ID(' tempdb.dbo。## table1')IS NOT NULL
完整堆栈跟踪
在 cfrecords2dcollector2ecfm1769031009._factor5(//汉福特/数据/ sitedata / WBT / WBT-dev的/ RecordsCollector /记录-collector.cfm:54) 在 cfrecords2dcollector2ecfm1769031009.runPage(//汉福特/数据/ sitedata / WBT / WBT-dev的/ RecordsCollector /记录-collector.cfm:1) 在 cfrecords2dcollector2ecfm1769031009._factor5(//汉福特/数据/ sitedata / WBT / WBT-dev的/ RecordsCollector /记录-collector.cfm:54) 在 cfrecords2dcollector2ecfm1769031009.runPage(//汉福特/数据/ sitedata / WBT / WBT-dev的/ RecordsCollector /记录-collector.cfm:1)
java.sql.SQLSyntaxErrorException:[Macromedia] [SQLServer JDBC 驱动程序] [SQLServer]列名称无效' StudentID'。在 macromedia.jdbc.sqlserverbase.dda4.b(未知来源)at macromedia.jdbc.sqlserverbase.dda4.a(未知来源)at macromedia.jdbc.sqlserverbase.dda3.b(未知来源)at macromedia.jdbc.sqlserverbase.dda3.a(未知来源)at macromedia.jdbc.sqlserver.tds.ddr.v(未知来源)at macromedia.jdbc.sqlserver.tds.ddr.a(未知来源)at macromedia.jdbc.sqlserver.tds.ddr.a(未知来源)at macromedia.jdbc.sqlserver.ddj.l(未知来源)at macromedia.jdbc.sqlserverbase.ddde.e(未知来源)at macromedia.jdbc.sqlserverbase.ddde.a(未知来源)at macromedia.jdbc.sqlserverbase.ddde.v(未知来源)at macromedia.jdbc.sqlserverbase.ddde.r(未知来源)at macromedia.jdbc.sqlserverbase.ddde.execute(未知来源)at coldfusion.server.j2ee.sql.JRunStatement.execute(JRunStatement.java:348) 在coldfusion.sql.Executive.executeQuery(Executive.java:1364)at coldfusion.sql.Executive.executeQuery(Executive.java:1127)at coldfusion.sql.Executive.executeQuery(Executive.java:1058)at coldfusion.sql.SqlImpl.execute(SqlImpl.java:341)at coldfusion.tagext.sql.QueryTag.executeQuery(QueryTag.java:915)at coldfusion.tagext.sql.QueryTag.doEndTag(QueryTag.java:590)at cfrecords2dcollector2ecfm1769031009._factor5(\汉福特\数据\ sitedata \ WBT \ WBT-dev的\ RecordsCollector \记录-collector.cfm:54) 在 cfrecords2dcollector2ecfm1769031009.runPage(\汉福特\数据\ sitedata \ WBT \ WBT-dev的\ RecordsCollector \记录-collector.cfm:1) 在coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:231)at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:418)at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:399) 在 coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48) 在 coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:94)at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) 在coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)at at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) 在coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)at coldfusion.CfmServlet.service(CfmServlet.java:201)at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) 在jrun.servlet.FilterChain.doFilter(FilterChain.java:86)at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42) 在 coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) 在jrun.servlet.FilterChain.doFilter(FilterChain.java:94)at jrun.servlet.FilterChain.service(FilterChain.java:101)at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286) 在 jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543) 在 jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203) 在 jrunx.scheduler.ThreadPool $ DownstreamMetrics.invokeRunnable(ThreadPool.java:320) 在 jrunx.scheduler.ThreadPool $ ThreadThrottle.invokeRunnable(ThreadPool.java:428) 在 jrunx.scheduler.ThreadPool $ UpstreamMetrics.invokeRunnable(ThreadPool.java:266) 在jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)