SQL 2000 Transact – Getting Started

SQL Transact – Getting Started with the Query Analyser.

SQL Transact Query Analyzer  analyserOnce you have installed SQL server you may begin querying the databases with the Query Analyser.

To get started, click on the Start Menu, Programs, Microsoft SQL Server, then click on Query Analyser. 

Next, I would select the radio button ‘Connect Using: Windows Authentication’, finally click O.K.

SQL Query Analyzer and Browser WindowsOpening the Query Analyzer

Now you should see the main typing window on the right and the object browser on the left.

Note in the diagram opposite that the Tables in the Northwind database have been expanded.  .dbo stands for Database Owner.  Whereas the full name of a table would be database.dbo.table, this can be abbreviated to just table.

Making your first SQL Transact Query

Scenario: You want a list of all the customers in the Northwind database.

‘USE Northwind’ means select the Northwind database, not the MASTER database.  GO means execute the command. 

When you have finished typing in your statements, I run the command by pressing the CTRL (key) + e.   Alternatively, click on the green arrow in the toolbar.  (Between the blue tick and the database name box.)

Abbreviated path, it works – I like it!

 

— SQL statement to select all columns from the customers table.

 

USE Northwind
SELECT *
FROM Customers
GO

 

Full path, including the .dbo (database owner).  Too much typing! I prefer the abbreviated path above.

 

USE Northwind
SELECT *
FROM Northwind.dbo.Customers
GO