<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlserver.ro/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Intrebari</title><link>http://sqlserver.ro/forums/14/ShowForum.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Re: One random record</title><link>http://sqlserver.ro/forums/thread/3030.aspx</link><pubDate>Mon, 22 Oct 2007 05:22:51 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:3030</guid><dc:creator>alinescoo</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/3030.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=3030</wfw:commentRss><description>Verry verry nice. Mersi, asa o sa fac.</description></item><item><title>Re: One random record</title><link>http://sqlserver.ro/forums/thread/2995.aspx</link><pubDate>Fri, 19 Oct 2007 13:05:07 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2995</guid><dc:creator>rsocol</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2995.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=2995</wfw:commentRss><description>&lt;p&gt;Poţi să pui apelul funcţiei NEWID() într-un view, iar în funcţie să referi view-ul respectiv, de exemplu:&lt;/p&gt;&lt;p&gt;USE Northwind&lt;br&gt;GO&lt;br&gt;CREATE VIEW RandomOrders&lt;br&gt;AS&lt;br&gt;SELECT OrderID, EmployeeID, NEWID() as RandomID FROM Orders&lt;br&gt;GO&lt;br&gt;CREATE FUNCTION GetRandomOrder(@EmployeeID int)&lt;br&gt;RETURNS INT AS BEGIN&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RETURN (SELECT TOP 1 OrderID FROM RandomOrders WHERE EmployeeID=@EmployeeID ORDER BY RandomID)&lt;br&gt;END&lt;br&gt;GO&lt;br&gt;SELECT dbo.GetRandomOrder(1)&lt;br&gt;SELECT dbo.GetRandomOrder(1)&lt;br&gt;SELECT dbo.GetRandomOrder(1)&lt;br&gt;&lt;/p&gt;&lt;p&gt;Răzvan&lt;/p&gt;</description></item><item><title>Re: One random record</title><link>http://sqlserver.ro/forums/thread/2990.aspx</link><pubDate>Fri, 19 Oct 2007 09:43:36 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2990</guid><dc:creator>alinescoo</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2990.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=2990</wfw:commentRss><description>&lt;P&gt;As fi vrut sa fie chestia asta intr-o functie... si cum cu newID() nu merge in functie. Asa selectul independent merge, insa deoarece o folosesc in mai multe locuri mi-ar fi mai usor sa fie o functie.&lt;/P&gt;&lt;P&gt;Cat despre RAND()... as prefera o alta varianta. &lt;/P&gt;&lt;P&gt;Va multumesc pentru raspunsuri.&lt;/P&gt;</description></item><item><title>Re: One random record</title><link>http://sqlserver.ro/forums/thread/2989.aspx</link><pubDate>Fri, 19 Oct 2007 08:55:33 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2989</guid><dc:creator>Cryogenic1981</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2989.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=2989</wfw:commentRss><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="http://sqlserver.ro/Themes/default/images/icon-quote.gif"&gt; &lt;strong&gt;alinescoo:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;p&gt;Am o tabela in care am campurile: locatie, depozit. Inainte, nu aveam campul depozit, iar pt a alege o locatie random din tabela faceam:&lt;/p&gt;&lt;p&gt;Select top1 locatie&lt;/p&gt;&lt;p&gt;from tablea&lt;/p&gt;&lt;p&gt;Order by newid().&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;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 ?&lt;/p&gt;&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Select Top 1 Locatie From Tablela Where Depozit = @Depozit Order By NewId()&lt;br&gt;&lt;/p&gt;</description></item><item><title>Re: One random record</title><link>http://sqlserver.ro/forums/thread/2988.aspx</link><pubDate>Fri, 19 Oct 2007 08:50:22 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2988</guid><dc:creator>ggciubuc</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2988.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=2988</wfw:commentRss><description>&lt;P&gt;Poate reusiti cu functia random&lt;/P&gt;
&lt;P&gt;exemplu de folosire dat de Cristi Lefter &lt;A class="" href="http://sqlserver.ro/forums/thread/287.aspx"&gt;aici&lt;/A&gt;&lt;/P&gt;</description></item><item><title>One random record</title><link>http://sqlserver.ro/forums/thread/2987.aspx</link><pubDate>Fri, 19 Oct 2007 08:07:35 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2987</guid><dc:creator>alinescoo</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2987.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=14&amp;PostID=2987</wfw:commentRss><description>&lt;P&gt;Am o tabela in care am campurile: locatie, depozit. Inainte, nu aveam campul depozit, iar pt a alege o locatie random din tabela faceam:&lt;/P&gt;&lt;P&gt;Select top1 locatie&lt;/P&gt;&lt;P&gt;from tablea&lt;/P&gt;&lt;P&gt;Order by newid().&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;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 ?&lt;/P&gt;</description></item></channel></rss>