﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Özelleştirilmiş PRINT Prosedürü &#8211; SQL Server Eğitimleri</title>
	<atom:link href="https://sqlserveregitimleri.com/etiket/ozellestirilmis-print-proseduru/feed" rel="self" type="application/rss+xml" />
	<link>https://sqlserveregitimleri.com</link>
	<description>SQL Server ile ilgili her şey</description>
	<lastBuildDate>Thu, 25 May 2023 21:45:07 +0000</lastBuildDate>
	<language>tr</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.1</generator>
	<item>
		<title>SQL Server&#8217;da Özelleştirilmiş PRINT Prosedürü</title>
		<link>https://sqlserveregitimleri.com/sql-serverda-ozellestirilmis-print-proseduru</link>
		
		<dc:creator><![CDATA[Yavuz Selim Kart]]></dc:creator>
		<pubDate>Wed, 24 May 2023 06:14:57 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Özelleştirilmiş PRINT Prosedürü]]></category>
		<category><![CDATA[Print Kullanımı]]></category>
		<category><![CDATA[SQL Server PRINT]]></category>
		<guid isPermaLink="false">https://sqlserveregitimleri.com/?p=16362</guid>

					<description><![CDATA[Herkese merhaba. Bu yazıda SQL Server&#8217;da özelleştirilmiş PRINT prosedürü ile ilgili bilgi vermeye çalışacağım. SQL Server&#8217;da PRINT ifadesi 8000 karaktere kadar yazdırma işlemi yapar. Peki...]]></description>
										<content:encoded><![CDATA[<p>Herkese merhaba. Bu yazıda SQL Server&#8217;da özelleştirilmiş PRINT prosedürü ile ilgili bilgi vermeye çalışacağım.</p>
<p>SQL Server&#8217;da PRINT ifadesi 8000 karaktere kadar yazdırma işlemi yapar. Peki yazdığınız dinamik sorguların içeriği 8000 karakterden uzunsa ne yapacaksınız?</p>
<p>SQL Server&#8217;da bazı durumlarda 8000 karakterden daha fazla olan ifadeleri PRINT ile yazdırmak isteyebilirsiniz.</p>
<p>Aşağıdaki prosedürü kullanarak sizler de bu işlemi rahatlıkla yapabilirsiniz.</p>
<pre class="line-numbers"><code class="language-sql">CREATE PROCEDURE LONGPRINT
    @String NVARCHAR(MAX)
AS
BEGIN
    BEGIN TRY

    DECLARE @CurrentEnd BIGINT;
    DECLARE @Offset TINYINT; 
    SET @String = replace(replace(@String, CHAR(13) + CHAR(10), CHAR(10)), CHAR(13), CHAR(10))

    WHILE LEN(@String) &gt; 1
    BEGIN
        IF CHARINDEX(CHAR(10), @String) BETWEEN 1 AND 4000
        BEGIN
            SET @CurrentEnd =  CHARINDEX(CHAR(10), @String) -1
            SET @Offset = 2
        END
        ELSE
        BEGIN
            SET @CurrentEnd = 4000
            SET @Offset = 1
        END   
        PRINT SUBSTRING(@String, 1, @CurrentEnd) 
        SET @String = SUBSTRING(@String, @CurrentEnd + @Offset, LEN(@String))   
    END 
    END TRY
    BEGIN CATCH
        DECLARE @ErrorMessage VARCHAR(4000)
        SELECT @ErrorMessage = ERROR_MESSAGE()    
        RAISERROR(@ErrorMessage,16,1)
    END CATCH
END

--Kullanımı

DECLARE @Degisken VARCHAR(MAX)
SET @Degisken = REPLICATE('x', 60000)
EXEC LONGPRINT @Degisken</code></pre>
<p>Yukarıdaki prosedürü oluşturup kodu çalıştırınca aşağıdakine benzer bir sonuç göreceksiniz.</p>
<p><img fetchpriority="high" decoding="async" class="size-full wp-image-16363" src="https://sqlserveregitimleri.com/wp-content/uploads/2023/05/sql-serverda-ozellestirilmis-print-proseduru-1.jpg" alt="SQL Server'da Özelleştirilmiş PRINT Prosedürü" width="700" height="357" srcset="https://sqlserveregitimleri.com/wp-content/uploads/2023/05/sql-serverda-ozellestirilmis-print-proseduru-1.jpg 700w, https://sqlserveregitimleri.com/wp-content/uploads/2023/05/sql-serverda-ozellestirilmis-print-proseduru-1-600x306.jpg 600w, https://sqlserveregitimleri.com/wp-content/uploads/2023/05/sql-serverda-ozellestirilmis-print-proseduru-1-588x300.jpg 588w, https://sqlserveregitimleri.com/wp-content/uploads/2023/05/sql-serverda-ozellestirilmis-print-proseduru-1-315x161.jpg 315w, https://sqlserveregitimleri.com/wp-content/uploads/2023/05/sql-serverda-ozellestirilmis-print-proseduru-1-265x135.jpg 265w" sizes="(max-width: 700px) 100vw, 700px" /></p>
<p>Görüldüğü üzere 6000 karakteri LONGPRINT prosedürü ile yazdırmış olduk.</p>
<p>Herkese çalışma hayatında ve yaşamında başarılar kolaylıklar.</p>
<div class='epvc-post-count'><span class='epvc-eye'></span>  <span class="epvc-count"> 194</span><span class='epvc-label'> Kez Okundu</span></div>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
