小编kid*_*33t的帖子

SQL Server报告"无效的列名称",但该列存在且查询通过管理工作室工作

我遇到了一些僵局.我有一些由一些C#代码生成的查询.查询在Microsoft SQL Server Management Studio针对同一数据库运行时工作正常.

但是,当我的代码尝试运行相同的查询时,我得到关于无效列的相同错误,并抛出异常.引用此列的所有查询都失败.

最近将该列添加到数据库中.这是一个名为的日期列Incident_Begin_Time_ts.

失败的一个例子是:

select * from PerfDiag 
where Incident_Begin_Time_ts > '2010-01-01 00:00:00';
Run Code Online (Sandbox Code Playgroud)

其他查询Select MAX(Incident_Being_Time_ts);在代码中运行时也会失败,因为它认为列缺失.

有任何想法吗?

sql sql-server

104
推荐指数
5
解决办法
31万
查看次数

如何在包含引号(“”)的批处理文件中运行命令?

我有一个批处理文件正在尝试运行以下命令:

\n
FOR /F "tokens=1" %%G IN ('git show --pretty="format:" --name-only 54173344ab18a7d8e9ff2614cca62b671c8c7e2a') DO echo %%G \n
Run Code Online (Sandbox Code Playgroud)\n

这会导致 git error \xef\xbf\xbd\xef\xbf\xbdfatal: Invalid object name 'format'

\n

但是,如果我只是将命令本身放入批处理文件中,我就会得到预期的输出。

\n
git show --pretty="format:" --name-only 54173344ab18a7d8e9ff2614cca62b671c8c7e2a\n
Run Code Online (Sandbox Code Playgroud)\n

生产:

\n
Files/MyFiles/header.html\nFiles/MyFiles/foo.html\n
Run Code Online (Sandbox Code Playgroud)\n

这个问题与周围的引号有关"format:"

\n

我尝试使用 来逃避它们"",但没有成功。我也尝试过^。我尝试过使用该usebackq参数。

\n

如果你取出--pretty="format:"参数,这个循环也有效,但随后我会插入一堆额外的文本。

\n

windows powershell escaping batch-file

6
推荐指数
1
解决办法
1090
查看次数

速度在获取模板时投掷NPE

我有一些在本地运行良好的代码,但是当我尝试在远程服务器上运行它时,它会抛出一个空指针异常.尝试从Velocity获取模板时会这样做.它第一次失败,每次失败.

有问题的代码是这样的:

    URL location = Thread.currentThread().getContextClassLoader().getResource("velocity.properties");
    String fullPath = location.getPath();
    log.debug("Path: " + fullPath);
    Velocity.init(fullPath);
    Template tmplt = Velocity.getTemplate( "template.html" );  //This line throws the error
Run Code Online (Sandbox Code Playgroud)

记录显示路径是正确的,我可以验证文件是否存在.

用于初始化velocity的属性文件包含:

resource.loader = file
file.resource.loader.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader
file.resource.loader.path=/var/lib/tomcat6/webapps/geoip/WEB-INF/templates/template.html
file.resource.loader.cache = true

input.encoding=UTF-8
output.encoding=UTF-8
Run Code Online (Sandbox Code Playgroud)

错误的堆栈跟踪如下所示:

SEVERE: Servlet.service() for servlet Jersey REST Service threw exception
java.lang.NullPointerException
at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1533)
at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1514)
at org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingleton.java:299)
at org.apache.velocity.app.Velocity.getTemplate(Velocity.java:358)
at ca.company.ipservice.models.MyClass.toHTML(MyClass.java:48)
Run Code Online (Sandbox Code Playgroud)

我用Google搜索并搜索了StackOverflow,但我找不到任何答案.有任何想法吗?

java apache tomcat velocity jersey

5
推荐指数
1
解决办法
2835
查看次数