Showing posts with label string. Show all posts
Showing posts with label string. Show all posts

Monday, March 26, 2012

NOOPS in SQL query

Hello DBA's:
I need to exclude some words while doing a string comparison to get a good result. I do not need words like The, Of, And, In while comparing two strings. In short the record
The ABC Company OF XYZ
should match with BOTH
1. ABC
2. Company XYZCould you give us a bit more info of what you wanted to do? Or post your query if you can?|||You could use function replace() for deleting all 'noise' words. List of 'noise' words you can find \Mssql\Ftdata\Sqlserver\Config if Full-Text Search is installed.|||You can use the full text search feature of MS Sql server to do this kind of search operations.|||Have you looked into using the 'CONTAINS' clause?

You can do something like:

SELECT CompanyName
FROM Companies
WHERE CONTAINS(CompanyName, ' "ABC" OR "company" NEAR "XYZ" ')
GO

(You have to have FullText Indexing turned on for this to work)

Wednesday, March 21, 2012

Non-queried default values not working

This is driving me crazy. I can't get non-queried default values to
work with non-queried string report parameters. I'm using Reporting
Services 2000. Here's a test case: I have a simple Report Parameter: a
string, called "Color". It has three non-queried label-value pairs:
Red-red, Green-green, Blue-blue. I then try to define a default
non-queried value of green. Run the report, it always says "Select a
value". If I change the label-values to single-digit values, like
this: Red-1, Green-2, Blue-3, and set the default value to 2, then
Green comes up as the selected value (which is what I want). But I
cannot use a string for the value - it never matches. I've also tried
two-digit numbers: Red-11, Green-22, Blue-33, and used 22 as the
default. Comes up with "Select a value".
Can you not use strings as default values?Found the answer myself. Yes, you can use strings as default values,
as you would expect. Everything worked great in the Preview pane of
Visual Studio (the defaults would show properly) but when I put the
report on the report server, the dropdowns would say "Select a value".
To fix it, I had to completely delete the report from the server, and
upload a brand new copy of the RDL file. It did not work to simply use
the "Update" option in the Report Properties web page on the server.
It would update the report (i.e., I could see other changes I made) but
for some reason, the parameters would not work properly until I
completed deleted the report and uploaded it again. Go figure.

Saturday, February 25, 2012

No Trim Function?

Hi,
Is there an equivalent to the TRIM() function in SQL Server to remove any
leading or trailing blank spaces in a string variable?
Please advise.
Thanks,
-JoeSELECT LTRIM(RTRIM(' foo '))
"Joe Rigley" <jcrigley@.spartanmotors.com> wrote in message
news:eXkEC0jrFHA.3476@.TK2MSFTNGP10.phx.gbl...
> Hi,
> Is there an equivalent to the TRIM() function in SQL Server to remove any
> leading or trailing blank spaces in a string variable?
> Please advise.
> Thanks,
> -Joe
>|||RTRIM / LTRIM (look in the BOL)
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Joe Rigley" wrote:

> Hi,
> Is there an equivalent to the TRIM() function in SQL Server to remove any
> leading or trailing blank spaces in a string variable?
> Please advise.
> Thanks,
> -Joe
>
>|||Ahh! Thanks much!
BOL? What is that and how do I locate?
-Joe
"Jens Smeyer" <Jens@.[Remove_that][for contacting me]sqlserver2005.de>
wrote in message news:FBEB9AF1-211B-4B5B-8572-9D00F041C791@.microsoft.com...
> RTRIM / LTRIM (look in the BOL)
> --
> HTH, Jens Suessmeyer.
> --
> http://www.sqlserver2005.de
> --
>
> "Joe Rigley" wrote:
>|||BOL = Books Online.
http://www.aspfaq.com/2229
"Joe Rigley" <jcrigley@.spartanmotors.com> wrote in message
news:usv1t%23jrFHA.3796@.TK2MSFTNGP11.phx.gbl...
> Ahh! Thanks much!
> BOL? What is that and how do I locate?
> -Joe
> "Jens Smeyer" <Jens@.[Remove_that][for contacting me]sqlserver2005.de>
> wrote in message
> news:FBEB9AF1-211B-4B5B-8572-9D00F041C791@.microsoft.com...
>