Welcome to Sign in | Join | Help
» Search

Search

You searched for the word(s):
Showing page 5 of 7 (62 total posts) < 1 second(s)
  • Re: CASE in WHERE

    Deoarece am cam multe variante am adoptat varianta cu un tabel separat.Va multumesc ptr. raspunsuri
    Posted to T-SQL (Forum) by ssandu on July 3, 2008
  • Re: CASE in WHERE

    Ma gandeam sa nu mai fie nevoie de inca un tabel
    Posted to T-SQL (Forum) by ssandu on July 3, 2008
  • CASE in WHERE

    Cum pot sa fac urmatorul select (acum da eroare)SELECT * from tabelWHERE utilizator INCASEWHEN USER_NAME() = 'user1' THEN ('user1', 'user2')WHEN USER_NAME() = 'user3' THEN ('user3', 'user2')DEFAULT USER_NAME()ENDSe poate ?
    Posted to T-SQL (Forum) by ssandu on July 3, 2008
  • Re: Select ultimele valori

    eu intr-adevar am nevoie de exact match dar avand in vedere ca @comp are intotdeauna 2 caractere nu mai am nevoie de '%'.Chestia este ca merge mai repede cu LIKE (acum foloseste un Index Seek in loc de Scan).Multumesc ptr. raspunsuri.
    Posted to T-SQL (Forum) by ssandu on April 16, 2008
  • Re: Select ultimele valori

    ssandu:substring(t1.cod,1,2) = @comp inlocuit cu LIKE @comp reduce timpul sub o secunda.
    Posted to T-SQL (Forum) by ssandu on April 16, 2008
  • Re: Select ultimele valori

    Am reusit pana la urma sa reduc la 3 sec with tmp(pk_key, cod)As(&nbsp;&nbsp;&nbsp; select max(pk_key) as pk_key cod from tabel where data &lt;= @data group by cod)select pk_key, cod, sold, substring(cod,3,4) as grupafrom tabel t1 join tmp on t1.pk_key = tmp.pk_keywhere t1.sold &lt;&gt; 0 and substring(t1.cod,1,2) = @comporder by cod
    Posted to T-SQL (Forum) by ssandu on April 16, 2008
  • Re: Select ultimele valori

    ignatandrei:Ai putea, deci , sa optimizezi index scan ... sa il transformi intr-un seek.Poti sa-mi explici cum sa fac asta ?
    Posted to T-SQL (Forum) by ssandu on April 16, 2008
  • Re: Select ultimele valori

    Sunt aproximativ 300000 de inregistrari.Indecsi sunt pe tabel (este vorba de un singur tabel) : cod, data, cod+data, pk_key (primar. clustered)Numai daca nu gasesc o alta solutie o sa mai fac 2 campuri.In execution plan am un Index Scan de 74% pe&nbsp; indexul primar (pk_key)&nbsp; pentru expresia&nbsp; SUBSTRING(cod,1,2)=@comp si un Index Seek pe ...
    Posted to T-SQL (Forum) by ssandu on April 16, 2008
  • Select ultimele valori

    SalutAm o tabela pk_key(int), cod(char),sold(numeric), data(smalldatetime) din care sa extrag ultimele inregistrari la o anumita data la care soldul sa fie diferit de 0.Selectul pe care il am acum esteSELECT cod, sold, SUBSTRING(cod,3,4) as grupa FROM tabel t1WHERE sold &lt;&gt; 0 and SUBSTRING(cod,1,2) = @comp and pk_key = (SELECT ...
    Posted to T-SQL (Forum) by ssandu on April 16, 2008
  • Problema cu ultimele inregistrari

    SalutAm o tabela pk_key(int), cod(char),sold(numeric), data(smalldatetime) din care sa extrag ultimele inregistrari la o anumita data la care soldul sa fie diferit de 0.Selectul pe care il am acum esteSELECT cod, sold, SUBSTRING(cod,3,4) as grupa FROM tabel t1WHERE sold &lt;&gt; 0 and SUBSTRING(cod,1,2) = @comp and pk_key = (SELECT MAX(pk_key) as ...
    Posted to T-SQL (Forum) by ssandu on April 16, 2008
Powered by Community Server (Commercial Edition), by Telligent Systems