Welcome to Sign in | Help

Re: One random record

  •  10-19-2007, 11:55 AM

    Re: One random record

    alinescoo:

    Am o tabela in care am campurile: locatie, depozit. Inainte, nu aveam campul depozit, iar pt a alege o locatie random din tabela faceam:

    Select top1 locatie

    from tablea

    Order by newid().

     

    Ei, acum situatia e alta, si vreau sa fac random locatie doar pt un anumit depozit care sa fie parametru si sa il trimit eu. Pt asta m-am gandit la o functie tabela... problema e ca nu pot folosi newid() in functie, Ce alte alternative imi recomandati ?

     

    Select Top 1 Locatie From Tablela Where Depozit = @Depozit Order By NewId()

View Complete Thread
Powered by Community Server (Commercial Edition), by Telligent Systems