SQL Server Tutorials

How to arrange tables in SQL Server diagrams

Developers arrange the tables in a database diagram to see each table and relationship clearly. When developers working with SQL Server “Denali”, MS SQL Server 2008 R2 and MS SQL Server 2005 want to arrange tables in diagrams, they should follow the next steps:

1. Right-click in the empty space in the Database …

Learn more

How to save selected tables in SQL Server database diagram

Developers can save a specific table or a set of tables if they do not want to save all the changes they made in a database diagram. When Developers working with SQL Server “Denali”, MS SQL Server 2008 R2 and MS SQL Server 2005 want to save selected tables, they should follow the next steps:

1. In …

Learn more

How to open a database diagram in SQL Server Object Explorer

Developers whose are owner of the diagram or are members of the db_owner role of the database can open it to see or edit the diagram’s structure. When Developers working with SQL Server “Denali”, MS SQL Server 2008 R2 and MS SQL Server 2005 want to open a database diagram, they should follow the next steps:

1. …

Learn more

How to create a new table with SQL Server Table Designer

Developer can use Table Designer in SQL Server “Denali”,  MS SQL Server 2008 R2 and MS SQL Server 2005 to create a new table, name it, and add it to an existing database by following the next steps:

1. Right-clicks the Tables node of his/her database in Object Explorer and click New Table.

2. Types column …

Learn more

How to delete a table with SQL Server Table Designer

Developer can use Table Designer in SQL Server “Denali”,  MS SQL Server 2008 R2 and MS SQL Server 2005 to delete a table from the existing database by following the next steps:

1. In Object Explorer selects the table he/she wants to delete.

2. Right-clicks the table and chooses Delete from the shortcut menu.

3. …

Learn more

How to use SQL Server command sqlcmd to run a Transact-SQL script file

Developers should use sqlcmd to connect to a named instance of Microsoft SQL Server first and after they can run Transact-SQL script file.  A Transact-SQL script file is a text file that can contain a combination of Transact-SQL statements, sqlcmd commands, and scripting variables.  To run the script file, developers should follow the next steps:

1. Open …

Learn more

How to use SQL Server command sqlcmd to save output to a text file

Developers can run a Transact-SQL script file, by saving its output to a text file. In this case, developers should follow the next steps:

1. Open a command prompt window.

2. In the Command Prompt window, type:

sqlcmd -S server\instance -i C:\script.sql –o C:\result.txt

Where server is SQL server name, instance is SQL instance …

Learn more

How to rename a table with SQL Server Table Designer

Developers can rename a table in SQL Server “Denali”, MS SQL Server 2008 R2 and MS SQL Server 2005 Table Designer, by following the next steps:

1. In Object Explorer, right-click the table they want to rename and choose Design (Modify in SP1 or earlier).

The table opens in the Table …

Learn more

How to insert columns into a table with SQL Server Table Designer

Developers can use SQL Server “Denali”, MS SQL Server 2008 R2 and MS SQL Server 2005 Table Designer to add new columns to a table. When developers open a table in Table Designer, they see all of its currently defined columns as well as a blank row at the bottom of the table definition grid. They can add …

Learn more