<?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 generale</title><link>http://sqlserver.ro/forums/16/ShowForum.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Re: Procedura stocata...</title><link>http://sqlserver.ro/forums/thread/2719.aspx</link><pubDate>Thu, 20 Sep 2007 12:04:56 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2719</guid><dc:creator>ThePuiu</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2719.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=16&amp;PostID=2719</wfw:commentRss><description>am reusit sa prostesc crystalul pina la urma si am facut ce trebuia! Multumesc pt raspunsuri!</description></item><item><title>Re: Procedura stocata...</title><link>http://sqlserver.ro/forums/thread/2718.aspx</link><pubDate>Thu, 20 Sep 2007 10:46:18 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2718</guid><dc:creator>ThePuiu</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2718.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=16&amp;PostID=2718</wfw:commentRss><description>&lt;P&gt;am incercat cu exec si face ce vreau eu, dar din pacate am constatat ca nu pot sa construiesc un raport crystal pe o SP facuta asa...se pare ca trebuie sa fie definite in clar campurile ce vor fi in raport. Da o eroare: Must declare the scalar variable "@SQL". &amp;nbsp;Eu trebuie de fapt sa fac un select intre doua tabele si care sa aiba in cadrul lui WHERE o sintaxa diferita in functie de unele setari pe care le face userul. Din aceasta cauza ma gindeam ca mai simplu ar fi sa transmit tot stringul spre SP. Ce se poate face in cazul asta? EX:&lt;/P&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;ALTER&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;PROCEDURE&lt;/FONT&gt;&lt;FONT size=2&gt; [dbo]&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;FONT size=2&gt;[ListareNote] &lt;BR&gt;@SQL &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;varchar&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;FONT size=2&gt;500&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;)&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;AS&lt;BR&gt;BEGIN&lt;BR&gt;DECLARE&lt;/FONT&gt;&lt;FONT size=2&gt; @sqlL &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;nvarchar&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;FONT size=2&gt;4000&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;)&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;SELECT&lt;/FONT&gt;&lt;FONT size=2&gt; @sqlL &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;=&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#ff0000 size=2&gt;'SELECT PARTENERI.NUME,PARTENERI.LOCALITATEA,NOTE.DATA,NOTE.ID,NOTE.STATUS,NOTE.NUMECLIENT FROM PARTENERI INNER JOIN NOTE ON PARTENERI.ID = NOTE.ID_PARTENER WHERE ' + @SQL&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;EXEC&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;(&lt;/FONT&gt;&lt;FONT size=2&gt;@sqlL&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;)&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;END&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;/FONT&gt;</description></item><item><title>Re: Procedura stocata...</title><link>http://sqlserver.ro/forums/thread/2717.aspx</link><pubDate>Thu, 20 Sep 2007 08:36:17 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2717</guid><dc:creator>rsocol</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2717.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=16&amp;PostID=2717</wfw:commentRss><description>&lt;p&gt;Se poate, dar n-are niciun rost. Vezi:&lt;br&gt;&lt;a href="http://www.sommarskog.se/dynamic_sql.html#Common_cases" target="_blank"&gt;http://www.sommarskog.se/dynamic_sql.html#Common_cases&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Răzvan&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;</description></item><item><title>Re: Procedura stocata...</title><link>http://sqlserver.ro/forums/thread/2715.aspx</link><pubDate>Thu, 20 Sep 2007 08:13:15 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2715</guid><dc:creator>Cryogenic1981</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2715.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=16&amp;PostID=2715</wfw:commentRss><description>&lt;p&gt;poti cu:&amp;nbsp;&lt;/p&gt;&lt;p&gt;exec('select 123')&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;sau cu &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;exec sp_executesql @sql&lt;/p&gt;&lt;p&gt;pt. a refolosi planurile de executie a query-urilor&lt;/p&gt;&lt;p&gt;&amp;nbsp;vezi BOL pt. mai multe detalii, si ai grija la securitate sql-ul dinamic e f. periculos din punctul de vederea al securitatii. Iti recomand sa citesti in detaliu despre problemele de securitate care pot aparea.&lt;br&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Procedura stocata...</title><link>http://sqlserver.ro/forums/thread/2714.aspx</link><pubDate>Thu, 20 Sep 2007 07:44:25 GMT</pubDate><guid isPermaLink="false">963f3a18-65dd-4aad-905c-b785cfe1d7c7:2714</guid><dc:creator>ThePuiu</dc:creator><slash:comments>0</slash:comments><comments>http://sqlserver.ro/forums/thread/2714.aspx</comments><wfw:commentRss>http://sqlserver.ro/forums/commentrss.aspx?SectionID=16&amp;PostID=2714</wfw:commentRss><description>&lt;P&gt;Salut, trebuie sa fac o procedura stocata la care as vrea sa pot sa-i trimit ca si parametru sau intreaga sintaxa sql a interogarii sau daca nu se poate asa, conditia din WHERE. Adica ceva de genul:&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;PROCEDURE&lt;/FONT&gt;&lt;FONT size=2&gt; [dbo]&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;.&lt;/FONT&gt;&lt;FONT size=2&gt;[Listare] &lt;BR&gt;@SQL &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;nvarchar&lt;/FONT&gt;&lt;FONT size=2&gt;[500]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;AS&lt;BR&gt;BEGIN&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;SET&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;NOCOUNT&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ON&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;SQL&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;END&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;Se poate face asa ceva? Am cautat pe net, dar cred ca nu stiu cum sa formulez intrebarea...&lt;BR&gt;Multumesc!&lt;/P&gt;&lt;/FONT&gt;</description></item></channel></rss>