06 noiembrie 2012

Sql Server: limit query


SELECT * FROM (
  SELECT *, ROW_NUMBER() OVER (ORDER BY CompanyId) as row FROM Company
 ) a WHERE a.row > M and a.row <= N

-> intai ia primele (N-M) rezultate, dupa care le sorteaza dupa CompanyId

26 septembrie 2012

SQL Server: stergerea randurilor duplicate

ex:
SELECT companyName, contactName, address, country, postings, counting=count(*)
FROM TestTable
GROUP BY companyName, contactName, address,country, postings
HAVING count(*) > 0

- selectul are loc pe toate coloanele lui TestTable
- se obtin randurile unice, alaturi de nr. de aparitii pt fiecare

SELECT companyName, contactName, address, country, postings, counting=count(*)
INTO NewTable
FROM TestTable
GROUP BY companyName, contactName, address,country, postings
HAVING count(*) > 0

- se creeaza un nou tabel cu aceste randuri unice

DROP TABLE TestTable;

SELECT companyName, contactName, address, country, postings
INTO TestTable
FROM NewTable

DROP TABLE NewTable;

Si acum in TestTable se afla doar randurile unice.

22 august 2012

Exemplu simplu SOLR


<add>
<doc>
<field name="cat">book</field>
<field name="id">book-0</field>
<field name="name">The Legend of Po part 0</field>
</doc>

<doc>
<field name="cat">magazine</field>
<field name="id">book-1</field>
<field name="name">The Legend of Po part 1</field>
</doc>

<!-- .... -->

</add>

Fiecare field trebuie declarat in schema.xml ,  cu parametrii indexed si stored setati.
Proiectul cu toate jar-urile atasate:

Se acceseaza si la:

24 iulie 2012

The database is already in use by another process


Check why a port is blocked on windows

  1. Run command : "netstat -ano" and extract the pid of the process
  2. Task manager => Processes =>View => Select column : PID
  3. Order by pid and find the process