How to Create a View in SQL Server

To create a view in SQL Server:

  1. Open a new query by clicking the New Query button in the SSMS toolbar
  2. Type or paste a CREATE VIEW statement (example below)
  3. Run the script

The view will now be created in the database. You will be able to see it under the Views node in the Object Explorer.

You can now use SELECT statements against the view in future queries.

Below are screenshots of the above steps.

Continue reading

How to Use the Query Designer in SQL Server

To use the Query Designer in SQL Server:

  1. Open a new query by clicking New Query on the toolbar
  2. Open the Query Designer by selecting Query > Design Query in Editor... from the top menu
  3. Add the tables you want to run the query against
  4. Build the criteria for your query then click OK

The query will appear in the query window. To run the query, click ! Execute or press F5

Below are screenshots for the above steps.

Continue reading

How to Create a Table in SQL Server using a Query

To create a table in SQL Server using a query:

  1. In the SQL Server Management Studio, click the New Query button on the toolbar
  2. Type or paste a CREATE TABLE script (example below)
  3. Click the ! Execute button on the toolbar

Here’s an example:

Screenshot of SSMS with the New Query button highlighted.
Clicking the “New Query” button on the SSMS toolbar opens a new query. Clicking “Execute” runs the query.

Continue reading

How to Export from Access to Excel

To export from Access 2013 or 2016 to Excel:

  1. Open the table or query that contains the data you want to export
  2. Click the Excel download icon (from the EXTERNAL DATA tab on the Ribbon)
  3. Click OK to save the file at the default location. Alternatively, change the location and/or a file name. Select any other options you wish to include under Specify export options
  4. Click Close

Continue reading

How to Add a Macro Button to a Form in Access

To add a macro to a form in Access 2013 or 2016:

  1. Create a macro
  2. Now, open the form in Design view
  3. Click the Button icon in the Ribbon (from the DESIGN tab)
  4. In the Form Detail area, click and drag the cursor so that it forms a square or rectangle (i.e. shape of a button). The Command Button Wizard will pop up. Select Miscellaneous > Run Macro and click Next
  5. Select the name of the macro you want to run and click Next
  6. Choose whether to display text or an image on the button and click Next
  7. Give the button a name and click Finish

Continue reading

How to Create a Relationship in Access

To create a relationship in Access 2013 or 2016:

  1. While viewing a table in Design view, and ensuring that the DESIGN tab is selected, click Relationships from the Ribbon
  2. A Show Table dialog will appear with a list of tables and queries. Select the tables (and/or queries) that you wish to create a relationship between, and close the dialog
  3. The Relationships tab will appear with the selected tables. Click and drag a field on top of a field in another table to initiate a relationship.
  4. The Edit Relationships dialog will pop up containing both fields. Make any adjustments and click OK

This will create the relationship. You will see the tables in the Relationship tab with lines depicting the relationship between the tables.

Continue reading

How to Create a Form in Access

To create a form in Access 2013 or 2016:

  1. On the left navigation pane, click the table or query that contains the data for your form
  2. From the Create tab on the Ribbon, click Form

This creates a form based on the table or query that you selected from the navigation pane. You can modify the form as required.

You can also create a blank form (using the Blank Form button) or you can use the Form Wizard to create a form.

Continue reading

How to Create a Query in Access

To create a query in Access 2013 or 2016:

  1. Click the CREATE > Query Design button on the Ribbon.
  2. Choose the tables to include in the query
  3. Choose the fields to include, and adjust the criteria
  4. Click the Run button (or just switch to Datasheet view)

The results of the query will be displayed.

You also have the option of saving your query. To save the query, right-click on the query tab. click Save, and name it at the prompt.

Continue reading

What is a Stored Procedure?

A stored procedure is a series of SQL statements compiled and saved to the database.

Stored procedures can be as simple or as complex as you like. However, one of the benefits of stored procedures is that they allow you to store complex scripts on the server.

Stored procedures often contain conditional programming such as IF... ELSE statements for example. Stored procedures can also accept parameters.

Continue reading

What is a View?

In the world of databases, a view is a query that’s stored on a database.

The term can also be used to refer to the result set of a stored query.

To create a view, you write a query, then save it as a view.

To run a view, you query it, just like you’d query a table. The difference is that, the view itself is a query. So when you query the view, you’re effectively querying a query.  This enables you to save complex queries as views, then run simple queries against those views.

Continue reading