KEMBAR78
97 Select Into in SQL Server | PDF | Microsoft Sql Server | Entity Framework
0% found this document useful (0 votes)
28 views4 pages

97 Select Into in SQL Server

This document discusses the SELECT INTO statement in SQL Server, which allows users to select data from one table and insert it into a new table. It outlines various use cases, such as copying all rows and columns, selected columns, or rows based on conditions, and emphasizes that SELECT INTO cannot be used to insert data into an existing table. Additionally, it provides SQL scripts for creating example tables and demonstrates how to use the SELECT INTO statement effectively.

Uploaded by

realayoola007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views4 pages

97 Select Into in SQL Server

This document discusses the SELECT INTO statement in SQL Server, which allows users to select data from one table and insert it into a new table. It outlines various use cases, such as copying all rows and columns, selected columns, or rows based on conditions, and emphasizes that SELECT INTO cannot be used to insert data into an existing table. Additionally, it provides SQL scripts for creating example tables and demonstrates how to use the SELECT INTO statement effectively.

Uploaded by

realayoola007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

3/12/2023 Sql server, .

net and c# video tutorial: Select into in sql server


The Wayback Machine - https://web.archive.org/web/20211022001245/https://csharp-video-tutorials.blogspot.com/2015/09/select-into-in-sql-s…
More Create Blog Sign In

Sql server, .net and c# video tutorial


Free C#, .Net and Sql server video tutorial for beginners and intermediate programmers.

Support us .Net Basics C# SQL ASP.NET Aarvi MVC Slides C# Programs Subscribe Download

Select into in sql server

Suggested Videos
Part 94 - SQL Server trigger execution order
Part 95 - Audit table changes in sql server
Part 96 - Logon triggers in sql server

Pragim Technologies - Best software


training and placements in marathahalli,
bangalore. For further details please call
09945699393.

Complete Tutorials
How to become a full stack web
developer

Cloud computing complete tutorial

In this video we will discuss the power and use of SELECT INTO statement in SQL Healthy food for healthy mind and
Server. body

JavaScript tutorial

Bootstrap tutorial

Angular tutorial for beginners

Angular 5 Tutorial for beginners

https://web.archive.org/web/20211022001245/https://csharp-video-tutorials.blogspot.com/2015/09/select-into-in-sql-server.html 1/4
3/12/2023 Sql server, .net and c# video tutorial: Select into in sql server

Important Videos
The Gift of Education

Web application for your business

How to become .NET developer

Resources available to help you

Dot Net Video Tutorials


Blazor tutorial

C tutorial

ASP.NET Core Tutorial


We will be using the following 2 tables for the examples.
ASP.NET Core Razor Pages Tutorial

Angular 6 Tutorial

Angular CRUD Tutorial

Angular CLI Tutorial

Angular 2 Tutorial

Design Patterns

SQL Script to create Departments and Employees tables SOLID Principles


Create table Departments
( ASP.NET Web API
DepartmentId int primary key,
DepartmentName nvarchar(50) Bootstrap
)
AngularJS Tutorial
Go
jQuery Tutorial
Insert into Departments values (1, 'IT')
Insert into Departments values (2, 'HR') JavaScript with ASP.NET Tutorial
Insert into Departments values (3, 'Payroll')
Go JavaScript Tutorial

Create table Employees Charts Tutorial


(
LINQ
Id int primary key,
Name nvarchar(100), LINQ to SQL
Gender nvarchar(10),
Salary int, LINQ to XML
DeptId int foreign key references Departments(DepartmentId)
) Entity Framework
Go
WCF
Insert into Employees values (1, 'Mark', 'Male', 50000, 1)
ASP.NET Web Services
Insert into Employees values (2, 'Sara', 'Female', 65000, 2)
Insert into Employees values (3, 'Mike', 'Male', 48000, 3) Dot Net Basics
Insert into Employees values (4, 'Pam', 'Female', 70000, 1)
Insert into Employees values (5, 'John', 'Male', 55000, 2) C#
Go
SQL Server
The SELECT INTO statement in SQL Server, selects data from one table and inserts
it into a new table. ADO.NET

ASP.NET
SELECT INTO statement in SQL Server can do the following
1. Copy all rows and columns from an existing table into a new table. This is extremely GridView
useful when you want to make a backup copy of the existing table.
SELECT * INTO EmployeesBackup FROM Employees ASP.NET MVC

2. Copy all rows and columns from an existing table into a new table in an external Visual Studio Tips and Tricks
database.
SELECT * INTO HRDB.dbo.EmployeesBackup FROM Employees Dot Net Interview Questions

Slides
https://web.archive.org/web/20211022001245/https://csharp-video-tutorials.blogspot.com/2015/09/select-into-in-sql-server.html 2/4
3/12/2023 Sql server, .net and c# video tutorial: Select into in sql server

Entity Framework
3. Copy only selected columns into a new table
SELECT Id, Name, Gender INTO EmployeesBackup FROM Employees WCF

4. Copy only selected rows into a new table ASP.NET Web Services
SELECT * INTO EmployeesBackup FROM Employees WHERE DeptId = 1
Dot Net Basics
5. Copy columns from 2 or more table into a new table
C#
SELECT * INTO EmployeesBackup
FROM Employees SQL Server
INNER JOIN Departments
ON Employees.DeptId = Departments.DepartmentId ADO.NET

6. Create a new table whose columns and datatypes match with an existing table. ASP.NET
SELECT * INTO EmployeesBackup FROM Employees WHERE 1 <> 1
GridView
7. Copy all rows and columns from an existing table into a new table on a different SQL
ASP.NET MVC
Server instance. For this, create a linked server and use the 4 part naming convention
SELECT * INTO TargetTable Visual Studio Tips and Tricks
FROM [SourceServer].[SourceDB].[dbo].[SourceTable]

Please note : You cannot use SELECT INTO statement to select data into an existing Java Video Tutorials
table. For this you will have to use INSERT INTO statement. Part 1 : Video | Text | Slides

INSERT INTO ExistingTable (ColumnList) Part 2 : Video | Text | Slides


SELECT ColumnList FROM SourceTable
Part 3 : Video | Text | Slides

Interview Questions
C#

SQL Server

Written Test

5 comments:

Anonymous September 14, 2015 at 7:48 PM


Sir,
Please discuss CLR Trigger.

Thanks
Reply

Unknown September 15, 2015 at 12:29 PM


Hi venkat,

Please include some videos on understanding execution plan and performance tuning
concepts.

Thanks
Baskar M
Reply

Anas Nedal Mousa September 15, 2015 at 1:51 PM


Hello Venkat,

Thank you for all your videos, I'm sure everyone makes use of them in his own way, so

https://web.archive.org/web/20211022001245/https://csharp-video-tutorials.blogspot.com/2015/09/select-into-in-sql-server.html 3/4
3/12/2023 Sql server, .net and c# video tutorial: Select into in sql server
keep up the great work man :)

I have a question regarding "1 <> 1" to create the table with same schema as the
original table: I use "TOP 0" to get the schema of tables (e.g.: "SELECT TOP 0 * FROM
MyTable"), and I tried using TOP 0 instead of "WHERE 1 <> 1" and it worked, and so my
question is: what is the best way to get the schema to the original table? is it via using
"TOP 0" or via using "WHERE 1 <> 1" or something else?

Thank you again.


Reply

Unknown March 29, 2018 at 2:59 AM


Hi,
please discus the CLE Trigger,,,
Reply

Unknown March 29, 2018 at 3:02 AM


Hello Sir,

please include some video on understanding execution plan & performance tuning
concept.

regard,
Gaurav
Reply

Enter your comment...

Comment as: Google Accoun

Publish Preview

It would be great if you can help share these free resources

Newer Post Home Older Post

Subscribe to: Post Comments (Atom)

Powered by Blogger.

https://web.archive.org/web/20211022001245/https://csharp-video-tutorials.blogspot.com/2015/09/select-into-in-sql-server.html 4/4

You might also like