English 中文(简体)
传真服务器
原标题:SQL Server Not Returning Results With Specific Words in Parameterised Query

我用一个参数 Qu,从搜索箱中抽取一个特定词,但某些字眼正在制造问题。 其中之一是“篮子”。

它使用一个“Stepe”数据库Im,其中有一个称为“pad Thailand”的“Srecipe”;如果我把“thai”一词带入电线参数,则“Srecipe”将被退还罚款。 如果我通过“篮子”一词,盘问时间大约为10秒,没有记录。

I was suspicious of "pad" being a reserved keyword so I ve been trying other keywords; the only one I ve found causing the same problem so far is "proc".

任何想法,问题是什么,更重要的是,我如何处理这个问题。

问题回答

由于你没有提供关于HOW的详细数据,Im会做一些野gues,认为用参数分类的查询,你指的是一种储存程序,而你则通过全文(而不是最佳做法,但我不知道你使用的软件有什么限制)。

Anyway, the reason pad or proc might cause problems is because you don t explicitly tell the server that these are strings. For reasons I ve never truly understood, TSQL will allow you to pass single-word strings to (n)varchar parameters of procedures. A simple example would be :

EXEC sp_helpdb master

严格地说,这应当造成一yn误。 正确的辛迪加是:

EXEC sp_helpdb  master 

但是,发展中国家似乎对它的影响较小,这对生产力来说是巨大的! 因此,查询工作。

现在,如果你的程序如此的话:

EXEC p_find_recipe thai

这将穿透str,一切照旧。 然而,在使用诸如<代码>proc或>等保留词时,如<>file>>,会造成辛迪克斯错误,而且你需要确保围绕其工作价值进行引述。

All that said : - the syntax error should be returned right away, it shouldn t take 10 seconds - AFAIK pad is not a reseverd keyword

因此,我确信,我不敢回答你的问题,因此,我非常可能只花了10分钟打字,只字不提什么。

不管怎么说,你或许需要就你重新使用什么语言、你对准定点的含义提供一些额外的投入(也许指的是<代码>SlectT* ∗摘自WHERE外地=: syntax? s 之后填满吗?





相关问题
Export tables from SQL Server to be imported to Oracle 10g

I m trying to export some tables from SQL Server 2005 and then create those tables and populate them in Oracle. I have about 10 tables, varying from 4 columns up to 25. I m not using any constraints/...

SQL server: Can NT accounts be mapped to SQL server accounts

In our database we have an SQL server account that has the correct roles to access some of the databases. We are now switching to windows authentication and I was wondering if we can create a NT user ...

SQL Server 2000, ADO 2.8, VB6

How to determine if a Transaction is active i.e. before issuing Begin Transaction I want to ensure that no previous transaction are open.. the platform is VB6, MS-SQL Server 2000 and ADO 2.8

热门标签