August 30, 2020

SQL Tutorial – How to rename tables or columns



Another fantastic SQL Tutorial brought to you by BeardedDev.

In this video tutorial we learn how to rename columns and tables in SQL:

If you want to check out my video tutorial on how to create tables, click on the link: SQL Tutorial – Create Table with Constraints –

We are all human and that means sometimes we make mistakes when naming objects such as tables and columns in our database.

To rename columns or tables we can use the system stored procedure sp_rename.

In this video we go through examples using sp_rename to rename tables, rename columns and there is even a bonus query on how to rename an index.

If you are new to the channel and are interested in learning Data Development and Business Intelligence, hit the subscribe button or check out all of my videos using this link:

SQL Syntax:
CREATE TABLE dbo.CstomerDetals
(
Cust_Id INT IDENTITY(1, 1) NOT NULL
CONSTRAINT PK_Customr_Cust_Id PRIMARY KEY (Cust_Id)
, Title CHAR(5) NULL
, First_Name VARCHAR(50) NOT NULL
, Middle_Name VARCHAR(50) NOT NULL
, Last_Name VARCHAR(50) NOT NULL
, DBO DATE NOT NULL
)

EXEC sp_rename ‘dbo.CstomerDetals’, ‘CustomerDetails’

EXEC sp_rename ‘dbo.CustomerDetails.DBO’, ‘DOB’, ‘COLUMN’

EXEC sp_rename ‘dbo.CustomerDetails.PK_Customr_Cust_Id’, ‘PK_Customer_Cust_Id’, ‘INDEX’

Before renaming any objects it is important to identify any objects such as stored procedures that reference the object you are renaming as these will show an error that the name is not recognised when run.

Nguồn: https://belahanajima.com/

Xem thêm bài viết khác: https://belahanajima.com/cong-nghe/

Related Posts

epson l800 ink pad reset

June 29, 2020

June 29, 2020 20

epson l800 ink pad reset. epson l800 resetter. epson l800 ink pad resetter. epson l800 ink pad reset software. epson...

Windows Repair (All In One) FREE Repair Program

July 9, 2020

July 9, 2020 50

Windows Repair (All In One) FREE Repair Program by Tweaking.com Tweaking.com – Windows Repair is an all-in-one repair tool to...

Git Tutorial: Fixing Common Mistakes and Undoing Bad Commits

July 4, 2020

July 4, 2020 36

In this video we will look at some common mistakes in Git and how we can fix these mistakes. Specifically...

Replace Function SQL Server

July 4, 2020

July 4, 2020 1

Published on Aug 27, 2017: In this video tutorial, we will learn replace a string pattern with another string pattern...

how to Break/Remove winrar zip file password 100% working in Hindi | Urdu

July 6, 2020

July 6, 2020 32

Hello friends today in this video tutorial i am going to teach you how to remove password of winrar zip...

re:plus × Yusuke Shima / Glittering sea

July 7, 2020

July 7, 2020 22

from album “Prayer” Glittering sea written by re:plus Produced by re:plus × Yusuke Shima re:plus – Keyboard,guitar,bass,beat,program, mixing, mastering Yusuke...

How to Repair Corrupt Windows By Using COMMAND PROMPT!

July 6, 2020

July 6, 2020 1

How to Repair Corrupt Windows By Command Prompt! How to Repair Windows 10 using DISM 1. DISM /Online /Cleanup-Image /CheckHealth...

Reset va cài đặt chương trình board 1 kim mã vạch

July 5, 2020

July 5, 2020 23

Sewing machine repair channels always bring you the latest videos, Sign Up Channel to update the new videos, guys …...

ADOBE LIGHTROOM CC: How to reset adobe lightroom classic cc to default settings- Reset preferences

July 3, 2020

July 3, 2020 4

How to reset adobe lightroom classic cc to default settings Reset Lightroom preferences to default values ———————————————————————————————————– Adobe Lightroom is...

Tự học V-Ray Sketchup 2.0 Tập 2 : Setting – Render với HDRI

July 6, 2020

July 6, 2020 28

Hôm nay tôi gửi tới các bạn 1 video rất thú vị. Đó là Render với HDRI. Toàn bộ bí...

How to Clear the CMOS – Reset the BIOS & Why

July 7, 2020

July 7, 2020 37

Skip to 04:10 to bypass all the talking. Clearing the CMOS on your motherboard will reset your BIOS settings to...

Khôi phục cài đặt gốc Reset iPhone – Viettopcare

July 1, 2020

July 1, 2020 44

Xóa sạch dữ liệu trên máy iPhone là đưa về trạng thái mới ban đầu, còn được gọi là Factory...

Lounch Startup Repair Windows 7 #Start Windows Normally #Blue Screen Starting Windows

June 28, 2020

June 28, 2020 30

Lounch Startup Repair Windows 7 #Start Windows Normally #Blue Screen Starting Windows # – FRESHCOM Channel adalah Channel Youtube yang...

How to Reset Adobe illustrator to Default Settings || reset preferences illustrator cc 2020

June 30, 2020

June 30, 2020 9

Description: Thanks For Visit My Channel. I Hope You Like My Videos This channel is all about to 🔥Run time...

TÌM VÀ THAY THẾ TRONG WORD (FIND AND REPLACE) – HỒ NAM CHÂU

July 2, 2020

July 2, 2020 2

Link dữ liệu: TH6 – MICROSOFT WORD – TÌM VÀ THAY THẾ TRONG WORD (FIND AND REPLACE) NAMCHAU PHOTOSHOP –...

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *