Showing posts with label single. Show all posts
Showing posts with label single. Show all posts

Friday, March 30, 2012

More on Full Text Searching across multiple tables

Imagine you're building a search for a movie database which you wanted to index actors, quotes from scenes and movie names into a single search.... how do you accomplish this using full text search? The closest I can think of is... (for a sample search for "Walken"

select RANK, actorId as Id from FREETEXTTABLE( actors, *, 'ISABOUT (+ WALKEN + WEIGHT(1.0))') a JOIN actors b on a.[key] = b.actorid
UNION ALL
select RANK, sceneId as Id from FREETEXTTABLE( scenes, *, 'ISABOUT (+ WALKEN + WEIGHT(1.0))') a JOIN scenes b on a.[key] = b.sceneId
UNION ALL
select RANK, movieId as Id from FREETEXTTABLE( movie, *, 'ISABOUT (+ WALKEN + WEIGHT(1.0))') a JOIN movie b on a.[key] = b.movieId

But it doesn't rank correctly. Suggestions?

How do you want the ranking to work?

What do you want to return? have you tried

select RANK, actorId as Id from CONTAINSTABLE( actors, *, 'WALKEN') a JOIN actors b on a.[key] = b.actorid
UNION ALL
select RANK, sceneId as Id from CONTAINSTABLE( scenes, *, 'WALKEN') a JOIN scenes b on a.[key] = b.sceneId
UNION ALL
select RANK, movieId as Id from CONTAINSTABLE( movie, *, 'WALKEN') a JOIN movie b on a.[key] = b.movieId

The other thing to note is that RANK is not a fixed number it is relative to a number of factors, largely it is related to the batch of data a record was indexed with. So if you have records being indexed in differing batchs you can end up with odd ranking.

Bottom linke is a rank from tableA can't be used to compare with a rank from tableB

|||Ideally, i'd like to return the item(s), in order that match the query string. This means if the scene is a closer match than the movie, the scene is returned first. Each one should have the id returned which i can then construct a result from.|||

Unfortunately you can't use the rank from one index to compare with a rank from another index.

Have a lookin BOL under the heading "Understanding Ranking "

|||Right, what i'm looking for is a solution that will work across multiple tables... any suggestions?

Friday, March 23, 2012

Month Function - left pad single digit months

Month(now()) returns 1 in January. How do I left pad that 1 such that
it will return 01 for all single digit months?
Thanks.If you need an expression in report design, try this:
=IIF(Month(Now())<10,"0" & Month(Now()),"" & Month(Now()))
Or, even simple:
=Right("0" & Month(Now()),2)
"Scott" <SHBOSTON@.gmail.com> wrote in message
news:77e80f94-f3bf-49fc-a8ec-d4c526066713@.v17g2000hsa.googlegroups.com...
> Month(now()) returns 1 in January. How do I left pad that 1 such that
> it will return 01 for all single digit months?
> Thanks.

Monday, March 12, 2012

Monitoring netwrok traffic

Dear All,
I have 2 SQL Server 2000 computers. Each server contains data for one of
regional divisions. Company employees currently use a single data entry
application on client
computers. After the new application is installed, query response times
slow. My IT Manager ask me to monitor server traffic during business
hours to help him diagnose this problem. What should I do?
Thanks
Robert LieHi,
You can install a tool like MRTG to monitor network traffic or use the
windows performance monitor to track the number of bytes send/received per
second.
Erik
"robert lie" <robert.lie24@.gmail.com> wrote in message
news:OoShX$RZFHA.2884@.tk2msftngp13.phx.gbl...
> Dear All,
> I have 2 SQL Server 2000 computers. Each server contains data for one of
> regional divisions. Company employees currently use a single data entry
> application on client
> computers. After the new application is installed, query response times
> slow. My IT Manager ask me to monitor server traffic during business
> hours to help him diagnose this problem. What should I do?
> Thanks
> Robert Lie

Monitoring netwrok traffic

Dear All,
I have 2 SQL Server 2000 computers. Each server contains data for one of
regional divisions. Company employees currently use a single data entry
application on client
computers. After the new application is installed, query response times
slow. My IT Manager ask me to monitor server traffic during business
hours to help him diagnose this problem. What should I do?
Thanks
Robert LieHi,
You can install a tool like MRTG to monitor network traffic or use the
windows performance monitor to track the number of bytes send/received per
second.
Erik
"robert lie" <robert.lie24@.gmail.com> wrote in message
news:OoShX$RZFHA.2884@.tk2msftngp13.phx.gbl...
> Dear All,
> I have 2 SQL Server 2000 computers. Each server contains data for one of
> regional divisions. Company employees currently use a single data entry
> application on client
> computers. After the new application is installed, query response times
> slow. My IT Manager ask me to monitor server traffic during business
> hours to help him diagnose this problem. What should I do?
> Thanks
> Robert Lie

Monitoring netwrok traffic

Dear All,
I have 2 SQL Server 2000 computers. Each server contains data for one of
regional divisions. Company employees currently use a single data entry
application on client
computers. After the new application is installed, query response times
slow. My IT Manager ask me to monitor server traffic during business
hours to help him diagnose this problem. What should I do?
Thanks
Robert Lie
Hi,
You can install a tool like MRTG to monitor network traffic or use the
windows performance monitor to track the number of bytes send/received per
second.
Erik
"robert lie" <robert.lie24@.gmail.com> wrote in message
news:OoShX$RZFHA.2884@.tk2msftngp13.phx.gbl...
> Dear All,
> I have 2 SQL Server 2000 computers. Each server contains data for one of
> regional divisions. Company employees currently use a single data entry
> application on client
> computers. After the new application is installed, query response times
> slow. My IT Manager ask me to monitor server traffic during business
> hours to help him diagnose this problem. What should I do?
> Thanks
> Robert Lie

Monitoring Inserted data and comparing against selected data

I made ahuge load script in SQL Server 2000 as i load data from many
tables(select some of each one collumns) into one single table and i
want to test the loaded data against the selected data to make sure
that the loaded data is the same the selected data
is there a code or tool to make this test or monitoring ?? please
urgent ...tamatem wrote:

Quote:

Originally Posted by

I made ahuge load script in SQL Server 2000 as i load data from many
tables(select some of each one collumns) into one single table and i
want to test the loaded data against the selected data to make sure
that the loaded data is the same the selected data
is there a code or tool to make this test or monitoring ?? please
urgent ...


So you did a select ... into query? I'd be curious to know why exactly
you want to compare the two tables. Do you not trust the server to do
it correctly? It isn't really like a file copy or network transfer
where it's subject to errors.|||I agree.

You can trust SQL to do the job correctly or give an error. Just check
for @.@.ERROR to make sure that no error happened. I dont think you would
actually need to check whether the data got inserted properly.

ZeldorBlat wrote:

Quote:

Originally Posted by

tamatem wrote:

Quote:

Originally Posted by

I made ahuge load script in SQL Server 2000 as i load data from many
tables(select some of each one collumns) into one single table and i
want to test the loaded data against the selected data to make sure
that the loaded data is the same the selected data
is there a code or tool to make this test or monitoring ?? please
urgent ...


>
So you did a select ... into query? I'd be curious to know why exactly
you want to compare the two tables. Do you not trust the server to do
it correctly? It isn't really like a file copy or network transfer
where it's subject to errors.

Wednesday, March 7, 2012

Monitor network resources used by single database

Hi,

Is there any methord to monitor network utilization per database on single instance of SQLServer2005 or SQLServer2000.

Please help

Regards

Mohd Sufian

The tools are Profiler, accessable from the Tools menu in SSMS or Start/Programs/SQL Server/Performance Tools or perfmon accessable from Start/Programs/Administrative Tools/Performance.

The tool to use depends on the meaning of "network utilization". Profiler will allow you to run a trace you can use to aggregate reads, writes and duration by database. Perfmon has many counters that can be used by database.

See SQL Server 2005 Books Online topics:

SQL Server, Databases Object

http://msdn2.microsoft.com/en-US/library/ms189883.aspx

Monitoring Resource Usage (System Monitor)

http://msdn2.microsoft.com/en-us/library/ms191246.aspx