﻿<?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>SQL Server Alter Table Nedir &#8211; SQL Server Eğitimleri</title>
	<atom:link href="https://sqlserveregitimleri.com/etiket/sql-server-alter-table-nedir/feed" rel="self" type="application/rss+xml" />
	<link>https://sqlserveregitimleri.com</link>
	<description>SQL Server ile ilgili her şey</description>
	<lastBuildDate>Sat, 18 Mar 2023 12: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 Alter Table Kullanımı</title>
		<link>https://sqlserveregitimleri.com/sql-serverda-alter-table-kullanimi</link>
		
		<dc:creator><![CDATA[Yavuz Selim Kart]]></dc:creator>
		<pubDate>Tue, 07 Nov 2017 07:08:37 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Alter Table]]></category>
		<category><![CDATA[SQL Server Alter Table İşlemi]]></category>
		<category><![CDATA[SQL Server Alter Table Nedir]]></category>
		<guid isPermaLink="false">http://sqlserveregitimleri.com/?p=2354</guid>

					<description><![CDATA[Herkese merhaba, Bu yazıda SQL Server’da Alter Table kullanımı ile ilgili bilgi vermeye çalışacağım. SQL Server&#8217;da mevcut tablolarımızda bazen değişiklik yapmamız gerekebilir. Tabloya bir alan...]]></description>
										<content:encoded><![CDATA[<p>Herkese merhaba,</p>
<p>Bu yazıda SQL Server’da Alter Table kullanımı ile ilgili bilgi vermeye çalışacağım.</p>
<p>SQL Server&#8217;da mevcut tablolarımızda bazen değişiklik yapmamız gerekebilir. Tabloya bir alan eklemek, var olan alanın adını, tipini ,boyutunu değiştirmek gibi işlemler yapabiliriz. İşte bu tür düzenlemeleri yaparken ALTER TABLE ifadesini kullanıyoruz.</p>
<p>İlk olarak örnek bir tablo oluşturalım.</p>
<pre class="line-numbers"><code class="language-sql">CREATE TABLE Ogrenciler (
	OgrenciId INT
   ,Adi VARCHAR(50)
   ,Soyadi VARCHAR(50)
   ,Okulu VARCHAR(100)
   ,DogumTarihi DATETIME
);</code></pre>
<p>Tablo oluşturulduktan sonra bu şekilde bir mesaj almamız gerekli.</p>
<p><strong>Command(s) completed successfully.</strong></p>
<p>Şimdi bu tabloya bir alan ekleyelim.</p>
<pre class="line-numbers"><code class="language-sql">ALTER TABLE dbo.Ogrenciler ADD OkulNo VARCHAR(20);</code></pre>
<p>Bu kod ile tablomuza OkulNo adında Varchar(20) tipinde bir alan eklemiş olduk.</p>
<p>Alanı veritabanında Select komutu yardımı ile kontrol edelim.</p>
<pre class="line-numbers"><code class="language-sql">SELECT * FROM Ogrenciler AS o;</code></pre>
<p><img fetchpriority="high" decoding="async" class="alignnone wp-image-15593 size-full" src="https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-1.jpg" alt="SQL Server'da Alter Table Kullanımı" width="700" height="110" srcset="https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-1.jpg 700w, https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-1-315x50.jpg 315w" sizes="(max-width: 700px) 100vw, 700px" /></p>
<p>Şimdi bu tabloya birden çok alan ekleyelim.</p>
<pre class="line-numbers"><code class="language-sql">ALTER TABLE dbo.Ogrenciler
ADD AnneAdi VARCHAR(20),
    BabaAdi VARCHAR(40);</code></pre>
<p>Görüldüğü üzere birden çok alan ekleme işleminde virgül ile gerekli ayırma işlemini yaptıktan sonra eklenmek istenen alanlar adı ve veri tipi ile eklenir.</p>
<p>Alanları veritabanında Select komutu yardımı ile kontrol edelim.</p>
<pre class="line-numbers"><code class="language-sql">SELECT
	*
FROM Ogrenciler AS o;</code></pre>
<p><img decoding="async" class="alignnone wp-image-15594 size-full" src="https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-2.jpg" alt="SQL Server'da Alter Table Kullanımı" width="700" height="80" srcset="https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-2.jpg 700w, https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-2-315x36.jpg 315w" sizes="(max-width: 700px) 100vw, 700px" /></p>
<p>Tabloya Primary Key ekleyelim. Bu alanı ekleyeceğimiz ifadenin Not Null olması gerekir aksi türlü hata verecektir.</p>
<pre class="line-numbers"><code class="language-sql">ALTER TABLE dbo.Ogrenciler ADD PRIMARY KEY (OgrenciId);</code></pre>
<p>Alanı SQL tarafında Design&#8217;dan kontrol edelim.</p>
<p><img decoding="async" class="alignnone wp-image-15595 size-full" src="https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-3.jpg" alt="SQL Server'da Alter Table Kullanımı" width="700" height="562" srcset="https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-3.jpg 700w, https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-3-315x253.jpg 315w, https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-3-374x300.jpg 374w, https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-3-168x135.jpg 168w" sizes="(max-width: 700px) 100vw, 700px" /></p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-15596 size-full" src="https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-4.jpg" alt="SQL Server'da Alter Table Kullanımı" width="698" height="300" srcset="https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-4.jpg 698w, https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-4-315x135.jpg 315w" sizes="auto, (max-width: 698px) 100vw, 698px" /></p>
<p>Görüldüğü üzere OgrenciId alanımız Primary Key olmuş oldu.</p>
<p>Tabloya eklenmiş Primary Key alanını kaldıralım. Bu işlemi yapmadan önce Design kısmından şu bilgiyi öğrenmekte yarar var.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-15597 size-full" src="https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-5.jpg" alt="SQL Server'da Alter Table Kullanımı" width="700" height="507" srcset="https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-5.jpg 700w, https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-5-315x228.jpg 315w, https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-5-414x300.jpg 414w, https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-5-186x135.jpg 186w" sizes="auto, (max-width: 700px) 100vw, 700px" /></p>
<p>Bu kısımdan kaldıracağımız Primary Key&#8217;in ismini öğreniyoruz. Eğer biz düzgün bir isim veremdi isek bu kısım yazı ve numaralardan oluşabiliyor.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-15598 size-full" src="https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-6.jpg" alt="SQL Server'da Alter Table Kullanımı" width="700" height="510" srcset="https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-6.jpg 700w, https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-6-315x230.jpg 315w, https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-6-412x300.jpg 412w, https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-6-185x135.jpg 185w" sizes="auto, (max-width: 700px) 100vw, 700px" /></p>
<p>Bu kısımdan ismi aldıktan sonra aşağıdaki kodu yazıyoruz.</p>
<pre class="line-numbers"><code class="language-sql">ALTER TABLE dbo.Ogrenciler DROP CONSTRAINT PK_Ogrenciler;</code></pre>
<p>İşlem başarılı şekilde tamamlanıyor. Kontrol edersek.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-15599 size-full" src="https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-7.jpg" alt="SQL Server'da Alter Table Kullanımı" width="700" height="351" srcset="https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-7.jpg 700w, https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-7-315x158.jpg 315w, https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-7-598x300.jpg 598w, https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-7-269x135.jpg 269w" sizes="auto, (max-width: 700px) 100vw, 700px" /></p>
<p>Tablodan bir alan kaldırmak için ise</p>
<pre class="line-numbers"><code class="language-sql">ALTER TABLE dbo.Ogrenciler DROP COLUMN Okulu;</code></pre>
<p>Çıkarılmış alanı veritabanında Select komutu yardımı ile kontrol edelim.</p>
<pre class="line-numbers"><code class="language-sql">SELECT *
FROM Ogrenciler AS o;</code></pre>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-15600 size-full" src="https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-8.jpg" alt="SQL Server'da Alter Table Kullanımı" width="700" height="81" srcset="https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-8.jpg 700w, https://sqlserveregitimleri.com/wp-content/uploads/2017/11/sql-serverda-alter-table-kullanimi-8-315x36.jpg 315w" sizes="auto, (max-width: 700px) 100vw, 700px" /></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"> 614</span><span class='epvc-label'> Kez Okundu</span></div>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
