<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:georss="http://www.georss.org/georss" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" version="2.0">
  <channel>
    <title>Levent YILDIZ - T-Sql</title>
    <link>http://www.leventyildiz.net/</link>
    <description>coding @ the speed of thought</description>
    <language>en-us</language>
    <copyright>Levent YILDIZ</copyright>
    <lastBuildDate>Wed, 23 May 2007 19:27:05 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>levent.yildiz@lgytech.com</managingEditor>
    <webMaster>levent.yildiz@lgytech.com</webMaster>
    <item>
      <trackback:ping>http://www.leventyildiz.net/Trackback.aspx?guid=4fcd57e0-f451-484b-9034-a79544245e7a</trackback:ping>
      <pingback:server>http://www.leventyildiz.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.leventyildiz.net/PermaLink,guid,4fcd57e0-f451-484b-9034-a79544245e7a.aspx</pingback:target>
      <dc:creator>Levent YILDIZ</dc:creator>
      <wfw:comment>http://www.leventyildiz.net/CommentView,guid,4fcd57e0-f451-484b-9034-a79544245e7a.aspx</wfw:comment>
      <wfw:commentRss>http://www.leventyildiz.net/SyndicationService.asmx/GetEntryCommentsRss?guid=4fcd57e0-f451-484b-9034-a79544245e7a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Bırakın veritabanına kullanıcılar kendi formüllerini girsinler, uğraşılmaz bu kullanıcılarla
canım...<br /><span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"><br />
declare</span> @v1        <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">int</span>,<br />
        @v2        <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">int</span>,<br />
        @v3        <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">int</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">declare</span> @formula    <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">nvarchar</span>(50)<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">set</span> @v1=2<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">set</span> @v2=4<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">set</span> @v3=5<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">set</span> @formula=<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'SELECT
(@v1+@v3)*@v2'</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">set</span> @formula=<span style="FONT-SIZE: 11px; COLOR: fuchsia; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">replace</span>(@formula,<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'@v1'</span>,<span style="FONT-SIZE: 11px; COLOR: fuchsia; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">convert</span>(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">varchar</span>,@v1))<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">set</span> @formula=<span style="FONT-SIZE: 11px; COLOR: fuchsia; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">replace</span>(@formula,<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'@v2'</span>,<span style="FONT-SIZE: 11px; COLOR: fuchsia; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">convert</span>(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">varchar</span>,@v2))<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">set</span> @formula=<span style="FONT-SIZE: 11px; COLOR: fuchsia; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">replace</span>(@formula,<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'@v3'</span>,<span style="FONT-SIZE: 11px; COLOR: fuchsia; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">convert</span>(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">varchar</span>,@v3))<br /><br />
print @formula<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">EXEC</span><span style="FONT-SIZE: 11px; COLOR: brown; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">sp_executesql</span> @formula</span></p>
        <img width="0" height="0" src="http://www.leventyildiz.net/aggbug.ashx?id=4fcd57e0-f451-484b-9034-a79544245e7a" />
      </body>
      <title>Execute Dynamic SQL, Execute SQL on the FLY artık nasıl dersen...</title>
      <guid isPermaLink="false">http://www.leventyildiz.net/PermaLink,guid,4fcd57e0-f451-484b-9034-a79544245e7a.aspx</guid>
      <link>http://www.leventyildiz.net/2007/05/23/ExecuteDynamicSQLExecuteSQLOnTheFLYArt%c4%b1kNas%c4%b1lDersen.aspx</link>
      <pubDate>Wed, 23 May 2007 19:27:05 GMT</pubDate>
      <description>&lt;p&gt;
Bırakın veritabanına kullanıcılar kendi formüllerini girsinler, uğraşılmaz bu kullanıcılarla
canım...&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;
&lt;br&gt;
declare&lt;/span&gt; @v1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;int&lt;/span&gt;,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@v2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;int&lt;/span&gt;,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@v3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;int&lt;/span&gt;
&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;declare&lt;/span&gt; @formula&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;nvarchar&lt;/span&gt;(50)&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;set&lt;/span&gt; @v1=2&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;set&lt;/span&gt; @v2=4&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;set&lt;/span&gt; @v3=5&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;set&lt;/span&gt; @formula=&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;'SELECT
(@v1+@v3)*@v2'&lt;/span&gt;
&lt;br&gt;
&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;set&lt;/span&gt; @formula=&lt;span style="FONT-SIZE: 11px; COLOR: fuchsia; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;replace&lt;/span&gt;(@formula,&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;'@v1'&lt;/span&gt;,&lt;span style="FONT-SIZE: 11px; COLOR: fuchsia; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;convert&lt;/span&gt;(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;varchar&lt;/span&gt;,@v1))&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;set&lt;/span&gt; @formula=&lt;span style="FONT-SIZE: 11px; COLOR: fuchsia; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;replace&lt;/span&gt;(@formula,&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;'@v2'&lt;/span&gt;,&lt;span style="FONT-SIZE: 11px; COLOR: fuchsia; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;convert&lt;/span&gt;(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;varchar&lt;/span&gt;,@v2))&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;set&lt;/span&gt; @formula=&lt;span style="FONT-SIZE: 11px; COLOR: fuchsia; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;replace&lt;/span&gt;(@formula,&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;'@v3'&lt;/span&gt;,&lt;span style="FONT-SIZE: 11px; COLOR: fuchsia; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;convert&lt;/span&gt;(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;varchar&lt;/span&gt;,@v3))&lt;br&gt;
&lt;br&gt;
print @formula&lt;br&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;EXEC&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: brown; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;sp_executesql&lt;/span&gt; @formula&lt;/span&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leventyildiz.net/aggbug.ashx?id=4fcd57e0-f451-484b-9034-a79544245e7a" /&gt;</description>
      <comments>http://www.leventyildiz.net/CommentView,guid,4fcd57e0-f451-484b-9034-a79544245e7a.aspx</comments>
      <category>Post-It</category>
      <category>T-Sql</category>
    </item>
    <item>
      <trackback:ping>http://www.leventyildiz.net/Trackback.aspx?guid=dced701a-aa49-4db3-8ffd-6d63e2b0b9e1</trackback:ping>
      <pingback:server>http://www.leventyildiz.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.leventyildiz.net/PermaLink,guid,dced701a-aa49-4db3-8ffd-6d63e2b0b9e1.aspx</pingback:target>
      <dc:creator>Levent YILDIZ</dc:creator>
      <wfw:comment>http://www.leventyildiz.net/CommentView,guid,dced701a-aa49-4db3-8ffd-6d63e2b0b9e1.aspx</wfw:comment>
      <wfw:commentRss>http://www.leventyildiz.net/SyndicationService.asmx/GetEntryCommentsRss?guid=dced701a-aa49-4db3-8ffd-6d63e2b0b9e1</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
        <p>
 declare CURS_X cursor read_only forward_only for <br />
  (<br />
  select X1,X2 from ...<br />
  )<br /><br />
 open CURS_X<br />
 fetch next from CURS_X into @X1,@X2<br />
 while @@FETCH_STATUS=0<br />
  begin<br />
   .........<br />
   .........<br />
   --bir sonraki kayit okunuyor   <br />
   fetch next from CURS_X into @X1,@X2<br />
  end<br />
 close CURS_X<br />
 deallocate CURS_X<br /><br />
bundan sonra böyle, post-it lerimi burda tutmaya karar verdim.<br />
bu da ilki.yazarken iyi oluyor.
</p>
        <img width="0" height="0" src="http://www.leventyildiz.net/aggbug.ashx?id=dced701a-aa49-4db3-8ffd-6d63e2b0b9e1" />
      </body>
      <title>Post-It: t-sql cursor</title>
      <guid isPermaLink="false">http://www.leventyildiz.net/PermaLink,guid,dced701a-aa49-4db3-8ffd-6d63e2b0b9e1.aspx</guid>
      <link>http://www.leventyildiz.net/2007/05/19/PostItTsqlCursor.aspx</link>
      <pubDate>Sat, 19 May 2007 13:04:30 GMT</pubDate>
      <description>&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;declare&amp;nbsp;CURS_X&amp;nbsp;cursor&amp;nbsp;read_only&amp;nbsp;forward_only&amp;nbsp;for&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;(&lt;br&gt;
&amp;nbsp;&amp;nbsp;select&amp;nbsp;X1,X2&amp;nbsp;from ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;)&lt;br&gt;
&lt;br&gt;
&amp;nbsp;open CURS_X&lt;br&gt;
&amp;nbsp;fetch&amp;nbsp;next&amp;nbsp;from CURS_X&amp;nbsp;into @X1,@X2&lt;br&gt;
&amp;nbsp;while @@FETCH_STATUS=0&lt;br&gt;
&amp;nbsp;&amp;nbsp;begin&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;.........&lt;br&gt;
&amp;nbsp;&amp;nbsp; .........&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;--bir sonraki kayit okunuyor&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;fetch&amp;nbsp;next&amp;nbsp;from CURS_X&amp;nbsp;into @X1,@X2&lt;br&gt;
&amp;nbsp;&amp;nbsp;end&lt;br&gt;
&amp;nbsp;close CURS_X&lt;br&gt;
&amp;nbsp;deallocate CURS_X&lt;br&gt;
&lt;br&gt;
bundan sonra böyle, post-it lerimi burda tutmaya karar verdim.&lt;br&gt;
bu da ilki.yazarken iyi oluyor.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.leventyildiz.net/aggbug.ashx?id=dced701a-aa49-4db3-8ffd-6d63e2b0b9e1" /&gt;</description>
      <comments>http://www.leventyildiz.net/CommentView,guid,dced701a-aa49-4db3-8ffd-6d63e2b0b9e1.aspx</comments>
      <category>Post-It</category>
      <category>T-Sql</category>
    </item>
  </channel>
</rss>