Showing posts with label strange. Show all posts
Showing posts with label strange. Show all posts

Tuesday, March 27, 2012

Adding a new column of a UDT type fails on "invalid data type"

Hi all,

A strange thing happened to me a few days ago - I tried to modify a table, using the SQL server 2005 management studio, in order to add a new column to an existing table. I've entered the column's name and selected one of my UDTs for the column type. When I pressed "enter", I got the following message "invalid data type" !

Needless to say that shouldn't have happen, didn't happen it the previous version (CTP) and for some reason it works on other computers having the same version !

BTW, the database is sql server 2000.

Any ideas what this works on other computers but not on mine ?

Should I re-install the SQL server ? or the framework ?

Thanks,

Ido.

I'm still getting the error - currently on 2 out of 3 computers.

Any ideas ?

Ido.

sql

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
>
>

Activity Monitoring for a Single Table

We started experiencing a strange problem with one of our database last week. After analyzing the data and comparing with multiple backup sets, we found that data was randomly being deleted from a single table.
Is there any way to monitor a single table for activity, add, delete, change, etc? We want to do this for a day or so to identify the offending process.
Thanks,
William (Bill) Corder
wscorder@.hotmail.com
Sure, look up CREATE TRIGGER in Books Online. You can also run a trace
using Profiler (or better yet, a server-side trace without the GUI)...
"William (Bill) Corder" <wscorder@.hotmail.com> wrote in message
news:07955481-D3E1-48A9-AB7A-16ACA438B7DA@.microsoft.com...
We started experiencing a strange problem with one of our database last
week. After analyzing the data and comparing with multiple backup sets, we
found that data was randomly being deleted from a single table.
Is there any way to monitor a single table for activity, add, delete,
change, etc? We want to do this for a day or so to identify the offending
process.
Thanks,
William (Bill) Corder
wscorder@.hotmail.com
|||Aaron,
Thanks, I am setting up a trace to monitor the activity.
Bill
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:e5TEw8BOIHA.3852@.TK2MSFTNGP06.phx.gbl...
> Sure, look up CREATE TRIGGER in Books Online. You can also run a trace
> using Profiler (or better yet, a server-side trace without the GUI)...
>
> "William (Bill) Corder" <wscorder@.hotmail.com> wrote in message
> news:07955481-D3E1-48A9-AB7A-16ACA438B7DA@.microsoft.com...
> We started experiencing a strange problem with one of our database last
> week. After analyzing the data and comparing with multiple backup sets,
> we found that data was randomly being deleted from a single table.
> Is there any way to monitor a single table for activity, add, delete,
> change, etc? We want to do this for a day or so to identify the offending
> process.
> --
> Thanks,
> William (Bill) Corder
> wscorder@.hotmail.com
>
>
|||William (Bill) Corder (wscorder@.hotmail.com) writes:
> We started experiencing a strange problem with one of our database last
> week. After analyzing the data and comparing with multiple backup sets,
> we found that data was randomly being deleted from a single table.
> Is there any way to monitor a single table for activity, add, delete,
> change, etc? We want to do this for a day or so to identify the
> offending process.
A trigger that logs the deleted rows together with columns populated with
the output from host_name(), app_name(), SYSTEM_USER, getdate() etc is
definitely what you need.
A server-side trace as Aaron suggested gives you the offending statement
more directly, so that is also a good idea. The log table gives you what
was deleted and when, and from that you can look up the trace.
I had to do this recently. Except that I did not come very far. That is,
before I deployed my trigger to production, I tested it, and when I ran
a delete operation from the GUI, I found that the log table said that
two rows had been deleted. Oh-oh. The culprit was a DELETE statement in
a procedure where I had forgotten the WHERE clause, blush!
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
|||The just re-did this with a trigger and it is more direct. I get exactly
what I need. All I had to do was create a separate log table to to hold the
data.
Thanks for the help and I will take a look at LogManager.

Thanks,
William (Bill) Corder
wscorder@.hotmail.com
"Thomas Steinmaurer" <t.steinmaurer_dontbugmewithspam_@.upscene.com> wrote in
message news:#fQucLOOIHA.1212@.TK2MSFTNGP05.phx.gbl...
> Hi!
>
> You probably won't get the old/new field values with that. This is easily
> done with triggers, as Aaron has pointed out.
> There are tools out there, which help you to setup a trigger-based
> auditing solution. For instance, our MSSQL LogManager product is one of
> them.
>
> --
> Best Regards,
> Thomas Steinmaurer
> LogManager Series - Logging/Auditing Suites supporting
> InterBase, Firebird, Advantage Database, MS SQL Server and
> NexusDB V2
> Upscene Productions
> http://www.upscene.com