Showing posts with label contain. Show all posts
Showing posts with label contain. Show all posts

Wednesday, March 21, 2012

further informations

Just for the record:
- the statements are viewed exactly before execution with an unicode aware
application and they contain the right unicodes.
- the db columns supposed to store the unicodes are defined as nvarchar
- the db viewer (SQL Query Analizer) is also unicode aware. It shows right
unicodes for values inserted with "preparedStatements" but ''?...' for
those inserted with plain statements.
?Hint?
In statements we don't use the N prefix for the unicode values. F.ex.:
we do:
UPDATE Table1 SET Col1 = 'New Text' WHERE id = 1
not:
UPDATE Table1 SET Col1 = N'New Text' WHERE id = 1
Is there a way to eliminate the necessity of using N by means of DB/SQL
Server settings?
Many thanks in advance.I think the '? show up because you insert non-unicode strings, and
there's a mismatch between the code pages of the process that changes the
data and the process that reads the data.
The ideal way to fix this would be to stop generating UPDATE statements, if
you can't change your code like that then you need to insert the values as
Unicode.
As a side note, you'll want to pay attention to injection attacks.
In the statement below:
UPDATE Table1 SET Col1 = N'New Text' WHERE id = 1
If the value of 'Nex Text' comes from the user then you need to escape it
with QUOTENAME
UPDATE Table1 SET Col1 = QUOTENAME(N'New Text','''') WHERE id = 1
Otherwise it can be injected with >>>>New Text' do_a_bad_thing_here --<<<<
UPDATE Table1 SET Col1 = N'New Text' do_a_bad_thing_here -- WHERE id = 1
Ciprian Gerea
SDE, SqlServer
This posting is provided "AS IS" with no warranties, and confers no rights.
"Cristian Senchiu" <Cristian Senchiu@.discussions.microsoft.com> wrote in
message news:88F7BF72-A378-4A4D-9D42-E2F9F98C697A@.microsoft.com...
> Just for the record:
> - the statements are viewed exactly before execution with an unicode aware
> application and they contain the right unicodes.
> - the db columns supposed to store the unicodes are defined as nvarchar
> - the db viewer (SQL Query Analizer) is also unicode aware. It shows right
> unicodes for values inserted with "preparedStatements" but ''?...' for
> those inserted with plain statements.
> ?Hint?
> In statements we don't use the N prefix for the unicode values. F.ex.:
> we do:
> UPDATE Table1 SET Col1 = 'New Text' WHERE id = 1
> not:
> UPDATE Table1 SET Col1 = N'New Text' WHERE id = 1
> Is there a way to eliminate the necessity of using N by means of DB/SQL
> Server settings?
> Many thanks in advance.

Sunday, February 19, 2012

full-text search : noun & verb variatrions

My full-text search works fine and it returns correct results, including
records that contain the variation of the keywords.
I bind the result to a gridview (ASP.NET 2.0), and programatically replace
the matched keywords with a highlighted background etc.
The problem is, my program only highlights the exact keywords, but not the
variations of the keywords. (because I don't know what the latter is)
Is there a way that I can query from SQL server what the noun & verb
variations of a specific search word is?
Thanks.Not without building a lookup table of variations. The algorithm which does
the stemming seems to be an implementation of Porter Stemming algorithm.
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
"News User" <NewsUser@.newsuser.com> wrote in message
news:OTSoM9gpGHA.148@.TK2MSFTNGP04.phx.gbl...
> My full-text search works fine and it returns correct results, including
> records that contain the variation of the keywords.
> I bind the result to a gridview (ASP.NET 2.0), and programatically replace
> the matched keywords with a highlighted background etc.
> The problem is, my program only highlights the exact keywords, but not the
> variations of the keywords. (because I don't know what the latter is)
> Is there a way that I can query from SQL server what the noun & verb
> variations of a specific search word is?
> Thanks.
>|||"News User" <NewsUser@.newsuser.com> wrote in message
news:OTSoM9gpGHA.148@.TK2MSFTNGP04.phx.gbl...
> My full-text search works fine and it returns correct results, including
> records that contain the variation of the keywords.
> I bind the result to a gridview (ASP.NET 2.0), and programatically replace
> the matched keywords with a highlighted background etc.
> The problem is, my program only highlights the exact keywords, but not the
> variations of the keywords. (because I don't know what the latter is)
> Is there a way that I can query from SQL server what the noun & verb
> variations of a specific search word is?
>
Try asking in news:microsoft.public.sqlserver.fulltext

> Thanks.
>|||Thanks for the great tip. I went to this page:
http://www.tartarus.org/~martin/PorterStemmer/
and found a T-SQL script that I hope I can implement on my SQL server. I
will give it a shot.
THanks!
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:%235C3eOhpGHA.3584@.TK2MSFTNGP03.phx.gbl...
> Not without building a lookup table of variations. The algorithm which
> does the stemming seems to be an implementation of Porter Stemming
> algorithm.
> --
> 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
>
> "News User" <NewsUser@.newsuser.com> wrote in message
> news:OTSoM9gpGHA.148@.TK2MSFTNGP04.phx.gbl...
>

full-text search : noun & verb variatrions

My full-text search works fine and it returns correct results, including
records that contain the variation of the keywords.
I bind the result to a gridview (ASP.NET 2.0), and programatically replace
the matched keywords with a highlighted background etc.
The problem is, my program only highlights the exact keywords, but not the
variations of the keywords. (because I don't know what the latter is)
Is there a way that I can query from SQL server what the noun & verb
variations of a specific search word is?
Thanks.Not without building a lookup table of variations. The algorithm which does
the stemming seems to be an implementation of Porter Stemming algorithm.
--
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
"News User" <NewsUser@.newsuser.com> wrote in message
news:OTSoM9gpGHA.148@.TK2MSFTNGP04.phx.gbl...
> My full-text search works fine and it returns correct results, including
> records that contain the variation of the keywords.
> I bind the result to a gridview (ASP.NET 2.0), and programatically replace
> the matched keywords with a highlighted background etc.
> The problem is, my program only highlights the exact keywords, but not the
> variations of the keywords. (because I don't know what the latter is)
> Is there a way that I can query from SQL server what the noun & verb
> variations of a specific search word is?
> Thanks.
>|||"News User" <NewsUser@.newsuser.com> wrote in message
news:OTSoM9gpGHA.148@.TK2MSFTNGP04.phx.gbl...
> My full-text search works fine and it returns correct results, including
> records that contain the variation of the keywords.
> I bind the result to a gridview (ASP.NET 2.0), and programatically replace
> the matched keywords with a highlighted background etc.
> The problem is, my program only highlights the exact keywords, but not the
> variations of the keywords. (because I don't know what the latter is)
> Is there a way that I can query from SQL server what the noun & verb
> variations of a specific search word is?
>
Try asking in news:microsoft.public.sqlserver.fulltext
> Thanks.
>|||Thanks for the great tip. I went to this page:
http://www.tartarus.org/~martin/PorterStemmer/
and found a T-SQL script that I hope I can implement on my SQL server. I
will give it a shot.
THanks!
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:%235C3eOhpGHA.3584@.TK2MSFTNGP03.phx.gbl...
> Not without building a lookup table of variations. The algorithm which
> does the stemming seems to be an implementation of Porter Stemming
> algorithm.
> --
> 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
>
> "News User" <NewsUser@.newsuser.com> wrote in message
> news:OTSoM9gpGHA.148@.TK2MSFTNGP04.phx.gbl...
>> My full-text search works fine and it returns correct results, including
>> records that contain the variation of the keywords.
>> I bind the result to a gridview (ASP.NET 2.0), and programatically
>> replace the matched keywords with a highlighted background etc.
>> The problem is, my program only highlights the exact keywords, but not
>> the variations of the keywords. (because I don't know what the latter is)
>> Is there a way that I can query from SQL server what the noun & verb
>> variations of a specific search word is?
>> Thanks.
>