Sql-server Full Text CONTAINS + COLLATE to ignore accents issues - sql

Hi all im struggling a little here with using COLLATE to ignore accents whilst also using Contains full text.
Ive reduced the columns im searching down to just one for the example here, and im hard coding the actual parameter just to simply this until i understand it.
If i have
SELECT
Col1,
Title COLLATE SQL_Latin1_General_Cp850_CI_AI AS Title,
ColX
FROM
Foo
WHERE
CONTAINS((Title), '"suenos" OR "french"')
This only returns results with french. If i add the wild card after eg:
WHERE
CONTAINS((Title), '"suenos*" OR "french"')
I get results for Sueños and for french. Ive noticed the same behaviour with a LIKE and COLLATE, eg it only words with 'suenous%' as apposed to 'suenos'.
Why is this?
Thanks muchly.

Assumption: you are using sql2005 or later.
I believe you need to set Accent Sensitivity as ON or OFF when you first create the index.
CREATE FULLTEXT CATALOG AwCat WITH ACCENT_SENSITIVITY=OFF
GO
or alter it:
ALTER FULLTEXT CATALOG AwCat REBUILD WITH ACCENT_SENSITIVITY=ON
GO
You cand find out more here Microsoft SQL Server 9.0 Technical Articles
SQL Server 2005 Full-Text Search: Internals and Enhancements

Related

Using SSMA to convert from Access to SQL, scripting the fixes

I am using SSMA to convert from an Access db to a SQL 2019 DB.
There are some things I need to fix in the access DB so I am trying to figure out whether or not these things can be done via a query in access or you have to use the goofy UI and do everything manually.
So I had a couple of questions about queries in Microsoft Access:
Can you modify the 'required' attribute on a column within a table by using a query?
Can you configure Index (dupes) on a column by using a query?
Can you change validation rules using a query?
Can you create/delete relationships using a query?
Can you change the field length of a column by using a query?
Any examples of any of these would be helpful, when I google for ms access related things all of the content is either related to Access 2007/2010 or its very UI heavy rather than Query heavy.
I am trying to script this because I may have to do this migration several times.
Update: I was able to get most of what i needed figured out..
ALTER TABLE Users ALTER COLUMN Type CHECK(In ("I","U","") Or Is Null);
Still havent found a way to change the 'ValidationRule'.. trying to change it to
In ("I","U","") Or Is Null
Look into the Data Definition Language section of the MS Access SQL Reference, specifically the ALTER TABLE statement, which will cover the majority of your questions.
For example, in response to:
Can you change the field length of a column by using a query?
ALTER TABLE Table1 ALTER COLUMN Field1 TEXT(100)
The above will change the data type of the field Field1 within table Table1 to a text field accommodating 100 characters.

Is CARD a keyword in SQL? or: List of all SQL keywords

I'm adding a table to my database - CREATE TABLE dbo.Card - and SSMS is highlighting the word Card. I'm searching the internet trying to find out what that word means to SQL and if it is a keyword or not. I don't see it anywhere on Microsoft's list of SQL Reserved Words.
The main reason I care, aside from the highlighting bothering me, is that I want to avoid using any reserved words or keywords as schema/table/column/etc... names. When I absolutely have to - existing databases - I like to use square brackets to make things explicit.
Is Card a reserved word or keyword in SQL, or for any other reason unsafe to use as an identifier?
If it is safe to use, can anyone explain why SSMS is highlighting it?
If it is not 100% safe to use as a table name I'll most likely choose a different name.
Windows 8.1
SSMS v17.7
Red Gate - Up to date, including SQL Prompt 9.4.9
SQL Server 2017 (14.0)
Database Compatibility Level 2017 (140)
UPDATE
It looks like the main consensus is:
It is not a reserved or keyword
SSMS highlights it because reasons... It's probably used somewhere by MS SQL Server or SSMS
At this point I'm just terribly curious, but at least I know there's no need to worry. Thanks everyone for your answers.
No, card is not a reversed word in Microsoft SQLServer or SQL ANSI standard.
Card is definitely not a reserved keyword in SQL Server
You can check the complete list of reserved words Reserved Keywords (Transact-SQL)
SSMS highlights it because reasons... It's probably used somewhere by
MS SQL Server or SSMS
They are various keywords that have been subjectively chosen by Microsoft and placed into a list within the query editor syntax coloring file.
I suggest it's always good to use Delimited Identifiers ([] or ") when specifying table name and column names.
For example, the script you are using should be written as
CREATE TABLE [dbo].[Card](<Columns>)

In Oracle SQL how would you find a specific column entry(in an unknown table) in the database

Suppose I'm using Oracle SQL and I want to find out which columns in the database have these values:
FIM
FIM
FIM
FNP
FJH
What I do know is that it was designed using the eBusiness suite(I think it was Oracle Reports). So I can use eTRM to narrow down.
But can I just use a stored procedure( like this question ) to find where the values are?
thanks
Sounds to me like you have a couple of options. Create a SOLR index based off of your database and query against that OR you can use Oracle Text. My personal recommendation is to use SOLR and remove excess load from your database, that of course is preference and YMMV.

SQL Left/Deliminated Character

Pretty simple one today. I've got a column, let's call it title, with a bunch of project titles. What I need to to pull everything from the left of the ":" and do a left/right trim (I'm then going to be using that in a join later on but I just need a column with the new data for now). So here's an example of what the current column looks like:
And here's what I need it to look like after the query is run:
The problem is while the # are 6 characters now, I can't guarantee they'll always be 6 characters. So if I was doing this in Excel I'd use the deliminated feature or just write a left/len/search function. Wondering how to do the same in SQL. BTW, I'm using SQL Server Management Studio.
Thoughts?
Assuming that your number is always followed by a [space]:[space], then simply look for that first space, and use its location as the argument for a left-substring operation:
SELECT LEFT(Title, CHARINDEX(' ', Title, 0)) AS "New Title"
p.s. Just say you're using MS SQL Server. SSMS is just a management front-end for that database.
check this post out. it does exactly what you are trying to do.
SQL Server replace, remove all after certain character

Use FilterDescriptor for international encodings (chars with accents)

Simple question... I have a service which returns the users and I implemented a FilterDescriptor which calls that service to populate a grid.
The filterdescriptor has the Contains operator and it works fine as far as the user's first or last name does not have accents.
If I want to search for the 'Gómez' is my table, I want to be able to just type 'gomez', but that it's not working.
Is there a property or something I'm missing? How can I achieve that?
This question helped me out...
Ignoring accents in SQL Server using LINQ to SQL
ALTER TABLE IDBUsers ALTER COLUMN LastName nvarchar(256) COLLATE SQL_Latin1_General_CP1_CI_AI