|
SQL Server Home
SQL Server 2008 SQL Server TutorialAbout SQL ServerEnterprise Manager Create a Database Create a Table Adding Data Query Analyzer Views Stored Procedures SQL Server Security Create a Login DTS (Data Transformation Services) SQL Server Agent SQL Server Agent Jobs SQL Server Service Manager SQL Profiler SQL Server Summary FREE Hosting!With every domain name you register with ZappyHost, you get FREE hosting.$1.99 Domain NamesWith every new non-domain purchase thru ZappyHost, you get a domain name for only $1.99. |
SQL Server - SQL Query AnalyzerNote that this tutorial was written for those using the 2000 edition of SQL Server (SQL Server 2000). For later versions of SQL Server, check out the SQL Server 2008 tutorial. The SQL Query Analyzer is the main interface for running SQL queries against your database. You can use the SQL Query Analyzer to create and run adhoc scripts, or you can create SQL scripts and save them for later use. Accessing SQL Query AnalyzerYou can open Query Analyzer from Enterprise Manager by clicking Tools > Query Analyzer.
SQL Query Analyzer looks like this:
Tip: Before you open Query Analyzer, use Enterprise Manager to navigate to the database you'd like to work with. That way, Query Analyzer will open using that database. Object BrowserSQL Query Analyzer also has an "Object Browser" that you can use to browse and edit tables, views, and stored procedures. The Object Browser also displays a list of common SQL Server functions and their parameters. To open the Object Browser, press F8. Alternatively, you can click the Object Browser icon
Writing QueriesYou are now ready to write SQL queries against your database. You can use this interface to create database objects (such as databases, tables, views etc), insert data into a database table, select data, update data, delete data. The following screen shot shows an example of using a SQL 'select' statement to select data from a database:
When I started creating the above example, I forgot the name of the table that I wanted to select data from. That wasn't a problem. All I needed to do was navigate through the Object Browser until I saw the names of the tables in the left pane. When I saw the table I needed, I simply clicked and dragged it onto the workspace area (and releasing the mouse in the right spot). This is quite a nice feature of Query Analyzer/Object Browser as it can save you time. As you can see, the results of the query are displayed in the bottom pane. The above 'select' statement is an example of a SQL query. Apart from the occasional example, SQL queries are outside the scope of this tutorial. If you'd like to learn more about writing SQL queries, check out the SQL tutorial. Database Administration TasksMost of the database administration tasks that can be performed in Enterprise Manager (through the user interface) can be performed (programatically) in Query Analyzer. This tutorial concentrates on the Enterprise Manager method, mainly because it's usually a lot easier for new users to get their head around. Once you become more familiar with SQL Server, you may find yourself using Query Analyzer to perform many of the tasks that you started out doing in Enterprise Manager. Enjoy this website?
Oh, and thank you for supporting Quackit! |
Need Content for your Website?Get unique, quality digital content for your website. You can even earn money by reselling it!Includes:
|