显示标签为“varchar”的博文。显示所有博文
显示标签为“varchar”的博文。显示所有博文

2012年3月27日星期二

Full Text Searching

I am trying to run a full text serach on one field, a Varchar 2000.
say the field contains:
(before you break the seal of your new product box, please be careful to read all the instructions) ...for example
I search for keywords that may be in this field
Like:
product box
seal
instructions
and this row is included in the result set

but I would like to leave out words like all pronouns and 'a' and 'I' ...words that aren't going to matter to the search.

Does someone know where I can stgart in doing this full text searching?

Thanks,
EricWell I still haven't found much on this
Got the following articles
http://www.freevbcode.com/ShowCode.asp?ID=4224
(zip file is empty)
and http://www.microsoft.com/sql/evaluation/features/fulltext.asp (just says nothing really)

Do anyone know how this full text search works... an example perhaps?

Would be greatly appreciated.
Thanks,
Eric|||Can someone tell me please where this is wrong?
sSQL.Append("and (sr.description_of_problem = isnull(@.description, FREETEXT(sr.description_of_problem, @.description)) or sr.description_of_problem is null) ")|||look into"noise words" and"filters" in the full text search problem.

2012年3月26日星期一

full text search on views?

Can we buld full text search on views? If yes, can I build a search catalog on a view that allowed both varchar and text columns?

Hi Abhi,

I've asked help for Tony Ting which is full text expert and here are his comments:

Answer is yes, but you could only build fulltext on indexed view (materialized view) and column are limited to all available in normal case but not on text/ntext/image/xml column. The later constraint is came from the current limitation that index could not be created on a indexed view w/ text/ntext/image/xml, but fulltext column need a primary index to work on.
Hope this helps.

Thanks,
Ana Elisa - MSFT

full text search on views?

Can we buld full text search on views? If yes, can I build a search catalog on a view that allowed both varchar and text columns?

Hi Abhi,

I've asked help for Tony Ting which is full text expert and here are his comments:

Answer is yes, but you could only build fulltext on indexed view (materialized view) and column are limited to all available in normal case but not on text/ntext/image/xml column. The later constraint is came from the current limitation that index could not be created on a indexed view w/ text/ntext/image/xml, but fulltext column need a primary index to work on.
Hope this helps.

Thanks,
Ana Elisa - MSFT

Full Text Search Language Specification

I'm using FTS on on two columns (VARCHAR) of my database. The data is exported from a MySQL database to SQL Server. When populating the database the default language was set to English (or maybe neutral?), although 90% of the records are in Dutch. Now, when I change the FTS language specification to Dutch problems occur when querying the database. When I enter typical Dutch noise words in my query like "van" or "van der" the query does not return any results. When I set it back to Neutral the queries do return results, although a drawback is that I can't query for example plural forms of words. Could this be because, when populating the database, the correct language was not set? If so, is there a way to get the Full Text Index working with Dutch in a correct manner?

Thanks in advance for your replies! Would be great to get this working in Dutch!

Rino:

When I enter typical Dutch noise words in my query like "van" or "van der" the query does not return any results

I think ignoring the noise words is the feature of FTS and we can't manipulate it.

|||

Well, It think it is not really about ignoring the noise words. The are ignored by default, am I right?

To clarify things a bit: When I use the query "Van der Vaart" and the language for the FTS column is set to Dutch it returns no results. When I set the language to Neutral it does return results. Basically all it needs to do is find results for the part of the query that says "Vaart".

ps: We are using the excellent FTS Normalizer from E. Bachtal (http://ewbi.blogs.com/develops/2007/05/normalizing_sql.html) Could that possibly cause the issue described above?

|||

Got it solved...

For some reason if I add the language code in the SQL query it works: "...WHERE CONTAINS(table, @.query, LANGUAGE 1043)..."

2012年3月21日星期三

FULL TEXT SEARCH

Microsoft Says:
This example uses a variable instead of a specific search term.
USE pubs
GO
DECLARE @.SearchWord varchar(30)
SET @.SearchWord ='Moon'
SELECT pr_info FROM pub_info WHERE FREETEXT(pr_info, @.SearchWord)
at http://msdn.microsoft.com/library/de...fa-fz_2juc.asp
but what I want is to assign a value to the variable @.SearchWord from a query like
SET @.SearchWord = (SELECT top 1 Fields1 from TableName)
which seems to be not working and given a error.
Server: Msg 7631, Level 15, State 1, Line 15
Syntax error occurred near '''. Expected '_STRING' in search condition 'Some Value
'.
where 'Some value' will be the value selected by the query 'SELECT top 1 Fields1 from TableName', so can any one help me out that how to use a variable which has been asigned a value from a query not explicitly assigned like SET @.SearchWord ='Moon' ?, I
have tried every combination of wraping the variable with single and double qoutes but its not working
many thanks
Ahsan,
Since this is the fulltext newsgroup, I thought I'd provide an example of a successful variable assignment for your question:
declare @.keyword varchar(100), @.count int
set @.keyword = 'MyActivityList'
set @.count = (select count(*) from jtkane_ASP_Procs where contains(*,@.keyword))
print @.count -- returns: 1
A non-FTS solution using TOP 1 <valid_column_name> example:
declare @.SearchWord varchar(100)
SET @.SearchWord = (select top 1 ASPFile from jtkane_ASP_Procs)
print @.SearchWord
-- returns: MyActivityList.cs
In your example below your variable @.SearchWord should be declared as the same datatype and lenght as the column named: Fields1 from your table named: TableName.
Hope this helps.
Regards,
John
"Ahsan" wrote:

> Microsoft Says:
> This example uses a variable instead of a specific search term.
> USE pubs
> GO
> DECLARE @.SearchWord varchar(30)
> SET @.SearchWord ='Moon'
> SELECT pr_info FROM pub_info WHERE FREETEXT(pr_info, @.SearchWord)
>
> at http://msdn.microsoft.com/library/de...fa-fz_2juc.asp
> but what I want is to assign a value to the variable @.SearchWord from a query like
> SET @.SearchWord = (SELECT top 1 Fields1 from TableName)
> which seems to be not working and given a error.
> Server: Msg 7631, Level 15, State 1, Line 15
> Syntax error occurred near '''. Expected '_STRING' in search condition 'Some Value
> '.
> where 'Some value' will be the value selected by the query 'SELECT top 1 Fields1 from TableName', so can any one help me out that how to use a variable which has been asigned a value from a query not explicitly assigned like SET @.SearchWord ='Moon' ?,
I have tried every combination of wraping the variable with single and double qoutes but its not working
> many thanks
>
>
|||John,
data type and length are same but I am still getting this error, I am using Sql server 2000 standard edition on windows 2000
ERROR IS:
Server: Msg 7631, Level 15, State 1, Line 19
Syntax error occurred near '''. Expected '_STRING' in search condition 'Kevin Durban- Jackson
'.
SELECT * From temp
QUERY:
SET QUOTED_IDENTIFIER OFF
declare @.vTemp as varchar(50)
SET @.vTemp = (SELECT ltrim(rtrim(FULLNAME)) FROM TEMP where incontact=46)
--Set @.vTemp = '"' + @.vTemp + '"'
--print @.vTemp
SELECT distinct * From temp
where
freetext(fullname,@.vTemp)
and freetext(address,'14 Marchmont Rd') AND contains(zip,'"SM6 9NU"')
TABLE SCRIPT:
CREATE TABLE [dbo].[Temp] (
[ID] [int] NOT NULL ,
[Address] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ZIP] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[FullName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[InContact] [numeric](18, 0) NULL ,
[Gender] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[RecentID] [int] NULL
) ON [PRIMARY]
GO
SAMPLE DATA:
(this is exported from sql server export facility)
1,14 Marchmont Rd
,SM6 9NU
,Kevin Durban- Jackson
,46,Male
,
2,14 Marchmont Road
,SM6 9NU
,Kevin Durban - Jackson
,42,Male
,
3,14 Marchmont Road
,SM6 9NU
,Kevin Durban- Jackson
,1,Male ,
4,14 Marchmont Rd
,SM6 9NU,Kevin Durban-jackson
,3,Male ,
5,14 Maplin Park
,SL3 8XY
,Jo Rowden
,1,Female
,
6,14 Maplin Park
,SL3 8XY
,Nige Bacon
,1,Male ,
7,14 Maplin Drive
,SK2 5XJ
,Viv Nash
,2,Male ,
8,14 Maple Wood
,NN10 0UN
,Kevin Durban-jackson
,1,Female ,
Could you give it a try by creating the sample table in your sql server john?
many thanks in advance
"John Kane" wrote:
[vbcol=seagreen]
> Ahsan,
> Since this is the fulltext newsgroup, I thought I'd provide an example of a successful variable assignment for your question:
> declare @.keyword varchar(100), @.count int
> set @.keyword = 'MyActivityList'
> set @.count = (select count(*) from jtkane_ASP_Procs where contains(*,@.keyword))
> print @.count -- returns: 1
> A non-FTS solution using TOP 1 <valid_column_name> example:
> declare @.SearchWord varchar(100)
> SET @.SearchWord = (select top 1 ASPFile from jtkane_ASP_Procs)
> print @.SearchWord
> -- returns: MyActivityList.cs
> In your example below your variable @.SearchWord should be declared as the same datatype and lenght as the column named: Fields1 from your table named: TableName.
> Hope this helps.
> Regards,
> John
>
> "Ahsan" wrote:
?, I have tried every combination of wraping the variable with single and double qoutes but its not working[vbcol=seagreen]
|||Ah!!!
Interesting thing I have found
Maximum length I have found in the data for fullname colum is 24
Max(len(fullname))
returns: 26
when I changed the length of the variable @.vtemp to 23, it works (amazed why so), well I have posted the whole code with sample table script and data.
just change the @.vtemp length
NOT WORKING: declare @.vTemp as varchar(50)
WORKING: declare @.vTemp as varchar(23)
error was:
Server: Msg 7631, Level 15, State 1, Line 22
Syntax error occurred near '''. Expected '_STRING' in search condition 'Kevin Durban- Jackson
'.
now the lenght of this 'Kevin Durban- Jackson
' is 26
I am wondering whats goin on, you ask me to check the data type and length and i checked it, it was right, but still I am wondering whats going on!!!, is there a limitation on the length of the variable one can use in freetext or contain ?
"Ahsan" wrote:
[vbcol=seagreen]
> John,
> data type and length are same but I am still getting this error, I am using Sql server 2000 standard edition on windows 2000
> ERROR IS:
> Server: Msg 7631, Level 15, State 1, Line 19
> Syntax error occurred near '''. Expected '_STRING' in search condition 'Kevin Durban- Jackson
> '.
> SELECT * From temp
> QUERY:
> SET QUOTED_IDENTIFIER OFF
> declare @.vTemp as varchar(50)
> SET @.vTemp = (SELECT ltrim(rtrim(FULLNAME)) FROM TEMP where incontact=46)
> --Set @.vTemp = '"' + @.vTemp + '"'
> --print @.vTemp
> SELECT distinct * From temp
> where
> freetext(fullname,@.vTemp)
> and freetext(address,'14 Marchmont Rd') AND contains(zip,'"SM6 9NU"')
> TABLE SCRIPT:
> CREATE TABLE [dbo].[Temp] (
> [ID] [int] NOT NULL ,
> [Address] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
> [ZIP] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
> [FullName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
> [InContact] [numeric](18, 0) NULL ,
> [Gender] [char] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
> [RecentID] [int] NULL
> ) ON [PRIMARY]
> GO
>
> SAMPLE DATA:
> (this is exported from sql server export facility)
> 1,14 Marchmont Rd
> ,SM6 9NU
> ,Kevin Durban- Jackson
> ,46,Male
> ,
> 2,14 Marchmont Road
> ,SM6 9NU
> ,Kevin Durban - Jackson
> ,42,Male
> ,
> 3,14 Marchmont Road
> ,SM6 9NU
> ,Kevin Durban- Jackson
> ,1,Male ,
> 4,14 Marchmont Rd
> ,SM6 9NU,Kevin Durban-jackson
> ,3,Male ,
> 5,14 Maplin Park
> ,SL3 8XY
> ,Jo Rowden
> ,1,Female
> ,
> 6,14 Maplin Park
> ,SL3 8XY
> ,Nige Bacon
> ,1,Male ,
> 7,14 Maplin Drive
> ,SK2 5XJ
> ,Viv Nash
> ,2,Male ,
> 8,14 Maple Wood
> ,NN10 0UN
> ,Kevin Durban-jackson
> ,1,Female ,
> Could you give it a try by creating the sample table in your sql server john?
> many thanks in advance
> "John Kane" wrote:
?, I have tried every combination of wraping the variable with single and double qoutes but its not working[vbcol=seagreen]

Full Text Problem Help please

DECLARE @.Wrd varchar(50)
SELECT UName
FROM Basic
WHERE CONTAINS(UName, @.Wrd)
Im using the the following query to get the user name from the table if the
user doesn't know it all. Im using SQLEXPRESS 2005 and it says i can't use
full text searching. Is there anything I can do, or can sum1 give me a query
that does the same job on my version of SQL. Thank you.sum1 ?
Look up LIKE in Books Online.
There is no full-text indexing in SQL 2005 Express.
ML|||Eamon,
Please, checkout the "SQL Server 2005 Features Comparison" at
http://www.microsoft.com/sql/2005/p...05features.mspx under
"Manageability", see that "Full Text Search" for "Express" is not check
marked, and therefore Full Text Search (FTS) is not supported in the SQL
Server 2005 Express edition.
I am curious, if you had a "full-text search" feature that was functional as
a 3rd party add-on to SQL 2005 Express would you find it useful? What
features are you looking for?
Thanks,
John
--
SQL Full Text Search Blog
http://spaces.msn.com/members/jtkane/
"eamon" <eamon@.discussions.microsoft.com> wrote in message
news:BCF75263-FB77-419E-9A09-55AD0E8FB363@.microsoft.com...
> DECLARE @.Wrd varchar(50)
> SELECT UName
> FROM Basic
> WHERE CONTAINS(UName, @.Wrd)
> Im using the the following query to get the user name from the table if
> the
> user doesn't know it all. Im using SQLEXPRESS 2005 and it says i can't use
> full text searching. Is there anything I can do, or can sum1 give me a
> query
> that does the same job on my version of SQL. Thank you.|||Well, I would be interested in a third party FTS tool. :) Have you seen
sqlTurbo?
ML|||ML,
Of course, its listed on my blog as SQL Turbo from Imceda. However, that's
not was what I was referring to, but more a low-cost T-SQL based FTS tool
for SQL Server 2000 MSDE or SQL Server 2005 Express. What features are you
looking for?
Thanks,
John
--
SQL Full Text Search Blog
http://spaces.msn.com/members/jtkane/
"ML" <ML@.discussions.microsoft.com> wrote in message
news:9BA03825-F792-4638-A78A-9F293E55EEF5@.microsoft.com...
> Well, I would be interested in a third party FTS tool. :) Have you seen
> sqlTurbo?
>
> MLsql

2012年3月11日星期日

Full text index query plans

I have a table with a full-text index on a given column. If I run the
following:
declare @.s varchar(100)
select @.s = 'fast'
select * from tblHannahRES where contains(RES_SER_TI, @.s)
select * from tblHannahRES where contains(RES_SER_TI, 'fast')
on my SQL2000/SP4 box I get substantially different access times, which
is unlike what I would get with a normal index i.e. performing the SQL
below (where the index is on ResID) yields identical plans and access
times:
declare @.i int
select @.i = 1463440
select * from tblHannahRES where ResID = @.i
select * from tblHannahRES where ResID = 1463440
With the full-text indices I get the plans shown below and the second
query is consistenly 6X faster than the first.
One thing I notice is that the remote scan itself costs 0.36 vs 0.06
though both generate the same number of rows. the second thing to
notice is that the first case incurs an extra sorting step (which costs
about 0.02 points). I'm not sure why this should be the case. Can
anyone elucidate on the issue here?
TIA - e
select * from tblHannahRES where contains(RES_SER_TI, @.s)
|--Nested Loops(Inner Join, OUTER
REFERENCES:([FULLTEXT:tblHannahRES].[KEY]) WITH PREFETCH)
|--Sort(ORDER BY:([FULLTEXT:tblHannahRES].[KEY] ASC))
| |--Remote Scan(OBJECT:(CONTAINS))
|--Clustered Index
S(OBJECT:([Merlin].[dbo].[tblHannahRES].[PK_tblHannahRES]),
SEEK:([tblHannahRES].[ResID]=[FULLTEXT:tblHannahRES].[KEY]) ORDERED
FORWARD)
select * from tblHannahRES where contains(RES_SER_TI, 'fast')
|--Nested Loops(Inner Join, OUTER
REFERENCES:([FULLTEXT:tblHannahRES].[KEY]) WITH PREFETCH)
|--Remote Scan(OBJECT:(CONTAINS))
|--Clustered Index
S(OBJECT:([Merlin].[dbo].[tblHannahRES].[PK_tblHannahRES]),
SEEK:([tblHannahRES].[ResID]=[FULLTEXT:tblHannahRES].[KEY]) ORDERED
FORWARD)thoughts anyone?
ekkis wrote:
> I have a table with a full-text index on a given column. If I run the
> following:
> declare @.s varchar(100)
> select @.s = 'fast'
> select * from tblHannahRES where contains(RES_SER_TI, @.s)
> select * from tblHannahRES where contains(RES_SER_TI, 'fast')
> on my SQL2000/SP4 box I get substantially different access times, which
> is unlike what I would get with a normal index i.e. performing the SQL
> below (where the index is on ResID) yields identical plans and access
> times:
> declare @.i int
> select @.i = 1463440
> select * from tblHannahRES where ResID = @.i
> select * from tblHannahRES where ResID = 1463440
> With the full-text indices I get the plans shown below and the second
> query is consistenly 6X faster than the first.
> One thing I notice is that the remote scan itself costs 0.36 vs 0.06
> though both generate the same number of rows. the second thing to
> notice is that the first case incurs an extra sorting step (which costs
> about 0.02 points). I'm not sure why this should be the case. Can
> anyone elucidate on the issue here?
> TIA - e
> select * from tblHannahRES where contains(RES_SER_TI, @.s)
> |--Nested Loops(Inner Join, OUTER
> REFERENCES:([FULLTEXT:tblHannahRES].[KEY]) WITH PREFETCH)
> |--Sort(ORDER BY:([FULLTEXT:tblHannahRES].[KEY] ASC))
> | |--Remote Scan(OBJECT:(CONTAINS))
> |--Clustered Index
> S(OBJECT:([Merlin].[dbo].[tblHannahRES].[PK_tblHannahRES]),
> SEEK:([tblHannahRES].[ResID]=[FULLTEXT:tblHannahRES].[KEY]) ORDERED
> FORWARD)
> select * from tblHannahRES where contains(RES_SER_TI, 'fast')
> |--Nested Loops(Inner Join, OUTER
> REFERENCES:([FULLTEXT:tblHannahRES].[KEY]) WITH PREFETCH)
> |--Remote Scan(OBJECT:(CONTAINS))
> |--Clustered Index
> S(OBJECT:([Merlin].[dbo].[tblHannahRES].[PK_tblHannahRES]),
> SEEK:([tblHannahRES].[ResID]=[FULLTEXT:tblHannahRES].[KEY]) ORDERED
> FORWARD)

Full Text Index not populating

I have a table with 13,000,000 records. I want to generate a full-text index on one column (a varchar 2000). I am able to define the full-text index, but when I click on "Start Full population", there is virtually no activity (no disk activity, no CPU activity, very little to indicate anything is happening.

When I check the properties of the catalog, it shows 1 MB size and 0 records in the catalog. The status of the catalog is "idle" and the display in EM shows that the last full population occurred at (about) the time that I generated the population request. I have generated the request by using EM (right click on table) and through SQL Agent with the same result (no catalog generated).

I am running SQL 2000 (SP4) on Windows 2000 (SP4) with 4 GB RAM and sufficient disk space available. I have enabled the full-text service and verified that it is running (I have stopped and restarted it as well).

I have worked with Full Text indexes before and never had any kind of issue before. Any thoughts or suggestions would be welcome.

Regards,

hmscott

CREATE TABLE [OMBRE_AUDIT_LOG] (
[LOG_SEQ_NBR] [numeric](18, 0) IDENTITY (1, 1) NOT NULL ,
[APP_NAME] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[USER_ID] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[USER_ORGANIZATION] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ACTION_START_DATE] [datetime] NOT NULL ,
[ACTION_END_DATE] [datetime] NULL ,
[ACTION_CODE] [int] NOT NULL ,
[VIEW_NAME] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[USER_DEF_TRACKING_NBR] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[CMD_XML_STREAM] [varchar] (2000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[REC_CREATE] [datetime] NULL CONSTRAINT [DF_OMBRE_AUDIT_LOG_REC_CREATE] DEFAULT (getdate()),
[REC_UPDATE] [datetime] NULL ,
[ATTENTION] [varchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[REASON] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
CONSTRAINT [PK_OMBRE_AUDIT_LOG] PRIMARY KEY CLUSTERED
(
[LOG_SEQ_NBR]
)
)
GOPoor scott :D ,

Have u checked any errors in Microsoft Windows 2000 Event Viewer application log which related to Microsft Search?

Another hint is ,

Make sure that the BUILTIN\Administrators login exists in SQL Server.|||Poor scott :D ,

I don't want sympathy, I want answers!!! :D

Have u checked any errors in Microsoft Windows 2000 Event Viewer application log which related to Microsft Search?

Ding! Score 1 point for mallier!


Make sure that the BUILTIN\Administrators login exists in SQL Server.
Ding! Ding! We have a winner!

WTF? Best practice says remove the BUILTIN\Administrator account and yet it's required for this!?! I gotta go read up more on Full text.

Thanks for the help!

Regards,

hmscott|||Hi,
I also got the same problem as you Scott.
I found I have the BUILTIN\Administrator in SQL Server.

So what will be the reason?|||To access existing full-text search catalogs, rebuild and repopulate them. The existing catalogs can also be accessed by switching back to an administrator account.|||Hi Satya,

I have the exact problem as Scott, could you give me some idea how to solve the problem please?

Full Text Index Error

I am trying to define Full Text Indexing on the following table:
CREATE TABLE [dbo].[CCINFORMATION] (
[Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[AWID] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Title] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Status] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Steffdt] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[CostCtr] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[CostCtrEffdt] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[PrevCostCtr] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Email] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[MgrName] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[MgrAWID] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[MgrEmail] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[MgrTitle] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ID] [int] IDENTITY (1, 1) NOT NULL
) ON [PRIMARY]
GO

But it keeps giving me the following error when I try to run the wizard:
The selected table has no
unique single column index on a column that does not allow NULLS.

Database: CCReport

Table: [dbo].[CCINFORMATION]

Both the AWID field, and the ID field (which I added after first receiving this message), are NOT NULL...what am I doing wrong here?I have a solution to this. The syntaxes which you have given..I have copied the same and run. It did give me the error which you have mentioned.

Go to table design and create a Primakry Key. I have set the ID column as the primary key. Now it creates the Full-Text Index.

Thanks & Regards,
Dipayan Sarkar
(dipayan@.covisible.com)
[CoVisible Solutions - a Knowledge Management Software Company)

2012年3月7日星期三

Full self join problem

Hi I have the following table
CREATE TABLE [Sales] (
[StoreID] [int] NOT NULL ,
[CatName] [varchar] (100) COLLATE Latin1_General_CI_AS NOT NULL ,
[WEDate] [smalldatetime] NOT NULL ,
[Best_Sales] [real] NOT NULL ,
[Corrected_Sales] [real] NOT NULL ,
[Total_Waste] [real] NOT NULL ,
[Availability] AS (case when ([Corrected_Sales] > 0 and ([Best_Sales]
> 0)) then ([Best_Sales] / [Corrected_Sales] * 100) else 0 end) ,
[Waste] AS (case when ([Total_Waste] > 0 and ([Best_Sales] > 0)) then
([Total_Waste] / [Best_Sales] * 100) else 0 end) ,
CONSTRAINT [PK_Sales] PRIMARY KEY CLUSTERED
(
[StoreID],
[CatName],
[WEDate]
) ON [PRIMARY] ,
CONSTRAINT [FK_Sales_Stores] FOREIGN KEY
(
[StoreID]
) REFERENCES [Stores] (
[ID]
) ON DELETE CASCADE ON UPDATE CASCADE
) ON [PRIMARY]
GO
The table holds sales records of a particular product catergory, in a
particular store in a particular week.
One week a catergory may be present which is not present in all weeks.
I would like to be able to compare sales of one week against another as
shown in the following example
Week,Cat,Store,Sales,Week,Cat,Store,Sales
1,Coat,50,50,2, coat, 50,10
1Hat,50, 10,null,null,null,null
null,null,null,null,2,Gloves,50,10
I have tried many different queries using full, left, right joins and
unions but i always seem to be only to get the result of an inner join.
here is one example i have tried
select a.catname from sales a
full join MandS.dbo.Sales b
on b.catname = a.catname
and b.weDate = '2006-09-23'
and b.storeid = 259
where a.weDate = '2006-09-16'
and a.storeid = 259
any help would be greatly appreciated.
Matt
On 28 Sep 2006 11:37:39 -0700, Matt S wrote:
(snip)
>here is one example i have tried
>select a.catname from sales a
>full join MandS.dbo.Sales b
>on b.catname = a.catname
>and b.weDate = '2006-09-23'
>and b.storeid = 259
>where a.weDate = '2006-09-16'
>and a.storeid = 259
Hi Matt,
The inclusion of columns from table a in the WHERE negates the effect of
the outer join - if a row from b was retained though there were no
matching values in a, the a columns are NULL, and the WHERE will discard
the row.
Try either
FROM (SELECT ?
FROM sales
WHERE weDate = '20060916'
AND storeid = 259) AS a
FULL JOIN (SELECT ?
FROM MandS.dbo.sales
WHERE weDate = '20060923'
AND storeid = 259) AS b
ON b.catname = a.catname
Or
FROM sales AS a
FULL JOIN MandS.dbo.Sales AS b
ON b.catname = a.catname
AND b.weDate = '20060923'
AND b.storeid = 259
AND a.weDate = '20060916'
AND a.storeid = 259
Hugo Kornelis, SQL Server MVP
|||thanks hugo the 1st option worked.

> FROM (SELECT ?
> FROM sales
> WHERE weDate = '20060916'
> AND storeid = 259) AS a
> FULL JOIN (SELECT ?
> FROM MandS.dbo.sales
> WHERE weDate = '20060923'
> AND storeid = 259) AS b
> ON b.catname = a.catname
>
I don't know why this post took so long to apear over 6 hours, which is
why it it listed several times.
Thanks for your help

Full self join problem

Hi I have the following table
CREATE TABLE [Sales] (
[StoreID] [int] NOT NULL ,
[CatName] [varchar] (100) COLLATE Latin1_General_CI_AS NOT NULL ,
[WEDate] [smalldatetime] NOT NULL ,
[Best_Sales] [real] NOT NULL ,
[Corrected_Sales] [real] NOT NULL ,
[Total_Waste] [real] NOT NULL ,
[Availability] AS (case when ([Corrected_Sales] > 0 and ([Best_Sales]
> 0)) then ([Best_Sales] / [Corrected_Sales] * 100) else 0 end) ,
[Waste] AS (case when ([Total_Waste] > 0 and ([Best_Sales] > 0)) then
([Total_Waste] / [Best_Sales] * 100) else 0 end) ,
CONSTRAINT [PK_Sales] PRIMARY KEY CLUSTERED
(
[StoreID],
[CatName],
[WEDate]
) ON [PRIMARY] ,
CONSTRAINT [FK_Sales_Stores] FOREIGN KEY
(
[StoreID]
) REFERENCES [Stores] (
[ID]
) ON DELETE CASCADE ON UPDATE CASCADE
) ON [PRIMARY]
GO
The table holds sales records of a particular product catergory, in a
particular store in a particular week.
One week a catergory may be present which is not present in all weeks.
I would like to be able to compare sales of one week against another as
shown in the following example
Week, Cat, Store, Sales, Week, Cat, Store, Sales
1, Coat, 50, 50, 2, coat, 50, 10
1 Hat, 50, 10, null, null, null, null
null, null, null, null, 2, Gloves, 50, 10
I have tried many different queries using full, left, right joins and
unions but i always seem to be only to get the result of an inner join.
here is one example i have tried
select a.catname from sales a
full join MandS.dbo.Sales b
on b.catname = a.catname
and b.weDate = '2006-09-23'
and b.storeid = 259
where a.weDate = '2006-09-16'
and a.storeid = 259
any help would be greatly appreciated.
MattOn 28 Sep 2006 11:37:39 -0700, Matt S wrote:
(snip)
>here is one example i have tried
>select a.catname from sales a
>full join MandS.dbo.Sales b
> on b.catname = a.catname
> and b.weDate = '2006-09-23'
> and b.storeid = 259
>where a.weDate = '2006-09-16'
>and a.storeid = 259
Hi Matt,
The inclusion of columns from table a in the WHERE negates the effect of
the outer join - if a row from b was retained though there were no
matching values in a, the a columns are NULL, and the WHERE will discard
the row.
Try either
FROM (SELECT '
FROM sales
WHERE weDate = '20060916'
AND storeid = 259) AS a
FULL JOIN (SELECT '
FROM MandS.dbo.sales
WHERE weDate = '20060923'
AND storeid = 259) AS b
ON b.catname = a.catname
Or
FROM sales AS a
FULL JOIN MandS.dbo.Sales AS b
ON b.catname = a.catname
AND b.weDate = '20060923'
AND b.storeid = 259
AND a.weDate = '20060916'
AND a.storeid = 259
--
Hugo Kornelis, SQL Server MVP|||thanks hugo the 1st option worked.
> FROM (SELECT '
> FROM sales
> WHERE weDate = '20060916'
> AND storeid = 259) AS a
> FULL JOIN (SELECT '
> FROM MandS.dbo.sales
> WHERE weDate = '20060923'
> AND storeid = 259) AS b
> ON b.catname = a.catname
>
I don't know why this post took so long to apear over 6 hours, which is
why it it listed several times.
Thanks for your help