We have two SQL Servers and on both of them FTS is enabled and should be configured the same way. Both run with the same server version. The SQL Server we have problems with runs in Azure.
I also have checked the wordbreaker language versions with the following statement. Both have the version 14.0.4763.1000 installed for German (1031).
EXEC sp_help_fulltext_system_components 'wordbreaker'
On one server, we do not get results properly, even though the word we are searching for exists in the table. With the following query we don't get any results:
SELECT *
FROM vsTst vsTst
WHERE CONTAINS(vsTst.Content, 'FORMSOF(INFLECTIONAL, Einzelunternehmen) OR "Einzelunternehmen*"', LANGUAGE 1031)
But with the keyword "Einzelunternehm" instead of "Einzelunternehmen" we get the results we are looking for:
SELECT *
FROM vsTst vsTst
WHERE CONTAINS(vsTst.Content, 'FORMSOF(INFLECTIONAL, Einzelunternehmen) OR "Einzelunternehm*"', LANGUAGE 1031)
We have absolutely no clue what the issue is. Does anybody have the same problem or have any idea what we have done wrong?
Thx
Related
I would like to find out which version of DB2 we are running on our IBM i server using only SQL SELECT.
I am executing my queries via installed ODBC drivers for i Access. The places I am executing the queries are Excel-ODBC and Excel-Microsoft Query (simply because I am not a developer and therefore don't have/don't know of another place to run queries).
The following solutions do not work for me:
How to check db2 version
Get DB2 instance name using SQL
Basic reasons why I have failed to get the above solutions to work:
I do not have a SYSPROC table/have access to SYSPROC table
SYSIBMADM table does not contain a ENV_INST_INFO table.
I think these answers may be tailored to those using IBM z, but I use IBM i.
My end goal is to be able to execute a SQL SELECT and get the version of DB2 used on our server.
Try this:
SELECT RELEASE_LEVEL, TEXT_DESCRIPTION
FROM QSYS2.SOFTWARE_PRODUCT_INFO
WHERE PRODUCT_ID = '5770SS1'
AND PRODUCT_OPTION = '27'
--or this instead of the above line:
--AND LOAD_TYPE = 'CODE' AND PRODUCT_OPTION = '*BASE'
I'm new with LinqPad and I would like to run two simple SQL statements at the same time so I can see the values in two tables. If I run the following individually it works but now when I run them at the same time. I get an error "invalid character".
Select * From Table1; Select * From Table2;
I found this article that suggests this format but it's not working for me.
How to run multiple SQL queries?
BTW: I'm using the free version of LinqPad 5.00.08 at the moment.
I know this is old, but I found this in my search for the same problem. (Using a SQL Server Compact database.) The way I was able to get mine to work was to add GO after each query.
SELECT * FROM Table1;
GO
SELECT * FROM Table2;
GO
You need to use Dump function
Table1.Dump();
Table2.Dump();
I am getting some strange behavior involving database queries that I have never seen before and I'm hoping you can illuminate the issue.
I have a table of data called myTable with some columns; thus far everything involving it has been fine. Now, I've just added a column called subTitle; and II notice that the SELECT * Query that pulls in the data for a given record is not aware of that column (it says the returned query does not have a subTitle column), but if I explicitly name the column (select subTitle) it is. I thought perhaps that the Coldfusion server might be caching the query so I tried to work around with cachedwithin="#CreateTimeSpan(0, 0, 0, 0)#" but no dice.
Consider the below code:
<cfquery name="getSub" datasource="#Application.datasourceName#">
SELECT subTitle
FROM myTable
WHERE RecordID = '674'
</cfquery>
<cfoutput>#getSub.subTitle#</cfoutput>
<cfquery name="getInfo" datasource="#Application.datasourceName#">
SELECT *
FROM myTable
WHERE RecordID = '674'
</cfquery>
<cfoutput>#getInfo.subTitle#</cfoutput>
Keeping in mind that record 674 has the string "test" in it's subTitle column the about of the above is
test
[[CRASH WITH ERROR]]
This doesn't make sense to me unless SQL Server 2008 has somehow cached the SELECT * query with the previous incarnation of the table, but the strange thing is if I run the query right from within SQL Management Studio there are no problems and it shows all columns with the select *
Frankly this one has me baffled; I know I can get around this by explicitly naming all the desired columns in the select query instead of using * (which is best practice anyway), but I want to understand why this is occurring.
I've worked with SQL Server 2005 for many years and never had something like this happen, which leads me to believe it might involve something new in SQL Server 2008; but then again the fact that the query works fine inside of the management studio doesn't jive with that either.
===UPDATE===
Clearing the Template Cache in the CF admin will solve the issue
Yes, ColdFusion caches the <cfquery> SQL string. If the underlying table structure changes, the result might be an exception like you see it.
Work-arounds:
Recommended solutiuons:
If you have the development or enterprise version you can view your query cache in the server moniter and clear only the queries there. (comment from #Dpolehonski, thanks)
Otherwise, click Clear Template Cache Now in the ColdFusion Administrator (under Server Settings/Caching).
This will invalidate all cached CFML-Templates on the server and CF will re-compile them when necessary.
Quick and dirty:
Subtly change the query SQL, for example add a space somewhere. When you are on a development machine it's the quickest way to fix the issue.
This will invalidate the compiled version of this query only and force a re-compile.
(Note that removing the subtle change will trigger the error again since the old query text will remain cached.)
Brute-force:
Re-start the ColdFusion server. Brutal, but effective.
Or the quick and super dirty method:
<cfquery name="getInfo" datasource="#Application.datasourceName#">
SELECT
*, #createUUID()# as starQueryCacheFix
FROM
myTable
WHERE
RecordID = '674'
</cfquery>
Don't leave in production code though... it'll obsolete all of the query caching ColdFusion does. I did say it was super dirty ;)
I'm running a pretty basic subquery on MySQL 4.0.30.
My goal is to get the user permissions from the mysql.user table for any user with grants on a specific database, as noted in the mysql.db table. The query looks like this:
mysql> select * from mysql.user where User IN
(select User from mysql.db where Db='db_name')\G
As you can see, it's pretty basic and follows the subquery syntax in the MySQL manual. However, when I execute that, it errors with the following response:
ERROR 1064: You have an error in your SQL syntax. Check the manual that
corresponds to your MySQL server version for the right syntax to use near 'select
User from mysql.db where Db='db_name')' at line 1
I also tried the command with = ANY instead of IN. I've run the same query on 4.1 and 5.0 versions of MySQL. Any help or insight on this is appreciated. Thanks
Ok, so it turns out I just didn't check the manual closely enough:
Starting with MySQL 4.1, all subquery forms and operations that the SQL standard requires are supported, as well as a few features that are MySQL-specific.
http://dev.mysql.com/doc/refman/4.1/en/subqueries.html
I'm trying to pull user data from 2 tables, one locally and one on a linked server, but I get the wrong results when querying the remote server.
I've cut my query down to
select * from SQL2.USER.dbo.people where persId = 475785
for testing and found that when I run it I get no results even though I know the person exists.
(persId is an integer, db is SQL Server 2000 and dbo.people is a table by the way)
If I copy/ paste the query and run it on the same server as the database then it works.
It only seems to affect certain user ids as running for example
select * from SQL2.USER.dbo.people where persId = 475784
works fine for the user before the one I want.
Strangely I've found that
select * from SQL2.USER.dbo.people where persId like '475785'
also works but
select * from SQL2.USER.dbo.people where persId > 475784
brings back records with persIds starting at 22519 not 475785 as I'd expect.
Hope that made sense to somebody
Any ideas ?
UPDATE:
Due to internal concerns about doing any changes to the live people table, I've temporarily moved my database so they're both on the same server and so the linked server issue doesn't apply. Once the whole lot is migrated to a separate cluster I'll be able to investigate properly. I'll update the update once this happens and I can work my way through all the suggestions. Thanks for your help.
The fact that LIKE operates is not a major clue: LIKE forces integers to string (so you can say WHERE field LIKE '2%' and you will get all records that start with a 2, even when field is of integer type). Your incorrect comparisons would lead me to think your indexes are corrupt, but you say they work when not used via the link... however, the selected index might be different depending on the use? (I seem to recall an instance when I had duplicate indexes and only one was stale, although that was too long ago to recall the exact cause).
Nevertheless, I would try rebuilding your index using the DBCC DBREINDEX (tablenname) command. If it turns out that doing so fixes your query, you may want to rebuild them all: here is a script for rebuilding them all easily.
Is dbo.people a table or a view? I've seen something similar where the underlying table schema had been changed and dropping and recreating the view fixed the problem, although the fact that the query works if run directly on the linked server does indicate something index based..
Is the linked server using the same collation? Depending on the index used, I could see something like this perhaps happening if the servers were not collation compatible, but the linked server was set up with collation compatible (which tells Sql Server it can run the query on the remote server).
I would check the following:
Check your definition on the linked server, and confirm that SQL2 is the
server you expect it to be
Check and compare the execution plans both from the remote and local servers
Try linking by IP address rather than name, to ensure you have the proper machine
Put the code into a stored procedure on the remote machine, and try calling that instead
Sounds like a bug to me - I;ve read of some issues along these lines, btu can't remember specifically what. What version of SQL Server are you running?
select * from SQL2.USER.dbo.people where persId = 475785
for a PersID which fails how does:
SELECT *
FROM OpenQuery(SQL2, 'SELECT * FROM USER.dbo.people WHERE persId = 475785')
behave?