Backup the entire table into a new table: SELECT * INTO [dbo].[NewTable] FROM [dbo].[ExistingTable] Select only particular columns into the new table or rename existing columns to new names: SELECT [Col1], [Col2] AS [NewCol2Name] INTO [dbo].[NewTable] FROM [dbo].[ExistingTable] Limit and filter the number of rows in the new table using…

Read more

SELECT - Basic

Select constant value: SELECT 1 — number SELECT ‘A’ — character SELECT 1, ‘A’ — multiple values Select expression: SELECT 1 + 1 SELECT ‘A’ + ‘A’ SELECT LEFT(‘ABC’, 1) + ‘BC’ Use an asterisk to show all columns: SELECT * FROM sys.tables Select specific columns: SELECT [object_id], [name] FROM…