Showing posts with label feature. Show all posts
Showing posts with label feature. Show all posts

Tuesday, March 6, 2012

Add Keywords to Query Analyzers Syntax

Does anyone know of a way to add *key words* to Query Analyzer's syntax
highlighting feature? I would think that there would be a text/xml file
that could be modified. This certainly can't be hard coded.

Thanks,
BryanI think you are going to be disappointed then. I know of no way to add
keywords in the way you want.

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org

"Bryan Bullard" <reply@.to.group.com> wrote in message
news:zBylc.6707$l_1.5292@.newssvr23.news.prodigy.co m...
> Does anyone know of a way to add *key words* to Query Analyzer's syntax
> highlighting feature? I would think that there would be a text/xml file
> that could be modified. This certainly can't be hard coded.
> Thanks,
> Bryan|||"Allan Mitchell" <allan@.no-spam.sqldts.com> wrote in message
news:4096bd6a$0$31706$fa0fcedb@.lovejoy.zen.co.uk.. .
> I know of no way to add keywords in the way you want.

Then do you know of another way?|||Bryan Bullard (reply@.to.group.com) writes:
> Does anyone know of a way to add *key words* to Query Analyzer's syntax
> highlighting feature? I would think that there would be a text/xml file
> that could be modified. This certainly can't be hard coded.

There is no way to change the list of highlighted words. I would actually
guess that the list is hardcoded. After all, QA is to designed against a
certain version of SQL Server, so new keywords are not likely to appear
out of the blue. :-)

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Bryan,

It seems that the keywords are contained in the file
"../tools/binn/sqllex.dll" -- part of which appears in plain-text. For fun,
I tried the following command from a Linux prompt (after backing up the
file):

sed 's/CHECKALLOC/RICHDILLON/' sqllex.dll > new.dll

... and then renamed the new file. Sure enough, QA stopped highlighing
"CHECKALLOC" in blue. Sadly, it wouldn't highlight my name, though. :-(
There must be something important about the rest of the gobbledygook in that
file ;-)

Rich

"Bryan Bullard" <reply@.to.group.com> wrote in message
news:zBylc.6707$l_1.5292@.newssvr23.news.prodigy.co m...
> Does anyone know of a way to add *key words* to Query Analyzer's syntax
> highlighting feature? I would think that there would be a text/xml file
> that could be modified. This certainly can't be hard coded.
> Thanks,
> Bryan|||

Quote:

Originally Posted by Erland Sommarskog

Bryan Bullard (reply@.to.group.com) writes:
> Does anyone know of a way to add *key words* to Query Analyzer's syntax
> highlighting feature? I would think that there would be a text/xml file
> that could be modified. This certainly can't be hard coded.

There is no way to change the list of highlighted words. I would actually
guess that the list is hardcoded. After all, QA is to designed against a
certain version of SQL Server, so new keywords are not likely to appear
out of the blue. :-)

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

It's actually hardcoded, and found this out the hardway when a dll was no longer registered.
the syntax highlighting functionality is done by a dll named sqllex.dll that is typically found in the C:\Program Files\Microsoft SQL Server\80\Tools\Binn directory;
if you unregister the dll, you'll lose the syntax highlighting completely; re-registering it restores the functionality, which i discovered when uninstalling/reinstalling after a beta of SQL 2005.
because the list of keywords is in the DLL, and not in a file the DLL uses, there's no way to ADD keywords unless you could replace that dll with your own enhanced verison.
HTH.

Add Keywords to Query Analyzers Syntax

Does anyone know of a way to add *key words* to Query Analyzer's syntax
highlighting feature? I would think that there would be a text/xml file
that could be modified. This certainly can't be hard coded.

Thanks,
BryanI think you are going to be disappointed then. I know of no way to add
keywords in the way you want.

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org

"Bryan Bullard" <reply@.to.group.com> wrote in message
news:zBylc.6707$l_1.5292@.newssvr23.news.prodigy.co m...
> Does anyone know of a way to add *key words* to Query Analyzer's syntax
> highlighting feature? I would think that there would be a text/xml file
> that could be modified. This certainly can't be hard coded.
> Thanks,
> Bryan|||"Allan Mitchell" <allan@.no-spam.sqldts.com> wrote in message
news:4096bd6a$0$31706$fa0fcedb@.lovejoy.zen.co.uk.. .
> I know of no way to add keywords in the way you want.

Then do you know of another way?|||Bryan Bullard (reply@.to.group.com) writes:
> Does anyone know of a way to add *key words* to Query Analyzer's syntax
> highlighting feature? I would think that there would be a text/xml file
> that could be modified. This certainly can't be hard coded.

There is no way to change the list of highlighted words. I would actually
guess that the list is hardcoded. After all, QA is to designed against a
certain version of SQL Server, so new keywords are not likely to appear
out of the blue. :-)

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Bryan,

It seems that the keywords are contained in the file
"../tools/binn/sqllex.dll" -- part of which appears in plain-text. For fun,
I tried the following command from a Linux prompt (after backing up the
file):

sed 's/CHECKALLOC/RICHDILLON/' sqllex.dll > new.dll

... and then renamed the new file. Sure enough, QA stopped highlighing
"CHECKALLOC" in blue. Sadly, it wouldn't highlight my name, though. :-(
There must be something important about the rest of the gobbledygook in that
file ;-)

Rich

"Bryan Bullard" <reply@.to.group.com> wrote in message
news:zBylc.6707$l_1.5292@.newssvr23.news.prodigy.co m...
> Does anyone know of a way to add *key words* to Query Analyzer's syntax
> highlighting feature? I would think that there would be a text/xml file
> that could be modified. This certainly can't be hard coded.
> Thanks,
> Bryan

Thursday, February 9, 2012

Actual frequency / count of a word

This is a strange request that has been submitted as "critical" feature of
an application, and I am not sure of how to approach the problem. The
application has a simple, perfectly good Full Text Search capability (it is
searching on "resumes" and "letters". Now we have been asked to allow the
user to specify the minimum number of "hits" for a particular search
criteria...
For example:
CREATE TABLE [dbo].[EmployeeResume]
(
[EmployeeId] [int] NOT NULL,
EmployeeId [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_EmployeeResume] PRIMARY KEY CLUSTERED
(
[EmployeeId] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
go
INSERT INTO EmployeeResume
VALUES(100, 'Resume containing words such as POWERPOINT')
INSERT INTO EmployeeResume
VALUES(200, 'Resume containing words such as POWERPOINT EXCEL ACCESS')
INSERT INTO EmployeeResume
VALUES(300, 'Resume containing words such as POWERPOINT EXCEL EXCEL ACCESS')
For sake of simplicity I omit all the code related to the creation of Full
Text catalog on the table and column "Resume"...
Now, the statement...
SELECT EmployeeId FROM EmployeeResume WHERE CONTAINS (Resume, 'EXCEL')
would return 2 rows (EmployeeID 200, 300)
Now we want to allow the user to specify that the query should return only
rows where the word "EXCEL" appears a minimum of 2 times -- in other words,
the query above should only return EmployeeId 300 because the "count" of the
word "EXCEL" is >= 2.
Strange, I know. Anyone has a suggestion?
Thank you so much in advance.
Giorgio
The feature you are looking for is called the hit count and ships with most
of Microsoft's search products but not SQL FTS. What you need to do is to
run a query on your results set that does something like this (untested).
SELECT EmployeeId,
hitcount=(len(resume)-len(replace(Resume,'Excel','')) )/len('excel')FROM
EmployeeResume WHERE CONTAINS (Resume, 'EXCEL')
and (len(resume)-len(replace(Resume,'Excel',''))/len('excel')
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Giorgio Vidali" <gvidali@.earthlink.net> wrote in message
news:%23aHTotT$GHA.396@.TK2MSFTNGP05.phx.gbl...
> This is a strange request that has been submitted as "critical" feature of
> an application, and I am not sure of how to approach the problem. The
> application has a simple, perfectly good Full Text Search capability (it
> is searching on "resumes" and "letters". Now we have been asked to allow
> the user to specify the minimum number of "hits" for a particular search
> criteria...
>
> For example:
>
> CREATE TABLE [dbo].[EmployeeResume]
> (
> [EmployeeId] [int] NOT NULL,
> EmployeeId [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
> CONSTRAINT [PK_EmployeeResume] PRIMARY KEY CLUSTERED
> (
> [EmployeeId] ASC
> )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
> ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
> go
>
> INSERT INTO EmployeeResume
> VALUES(100, 'Resume containing words such as POWERPOINT')
>
> INSERT INTO EmployeeResume
> VALUES(200, 'Resume containing words such as POWERPOINT EXCEL ACCESS')
>
> INSERT INTO EmployeeResume
> VALUES(300, 'Resume containing words such as POWERPOINT EXCEL EXCEL
> ACCESS')
>
> For sake of simplicity I omit all the code related to the creation of Full
> Text catalog on the table and column "Resume"...
>
> Now, the statement...
>
> SELECT EmployeeId FROM EmployeeResume WHERE CONTAINS (Resume, 'EXCEL')
>
> would return 2 rows (EmployeeID 200, 300)
>
> Now we want to allow the user to specify that the query should return only
> rows where the word "EXCEL" appears a minimum of 2 times -- in other
> words, the query above should only return EmployeeId 300 because the
> "count" of the word "EXCEL" is >= 2.
>
> Strange, I know. Anyone has a suggestion?
>
> Thank you so much in advance.
>
> Giorgio
>
>