Showing posts with label table. Show all posts
Showing posts with label table. Show all posts

Sunday, 27 September 2009

Display information from a table and change the column names

In my database table I have two columns : ProdID and Prod. When I query the database to display the IDs and the product names, I would like to make the result a bit more 'User friendly' by changing the column names to 'Product ID and 'Product'. I do this in the following way :


Open query analyser.
Select the required database.

Select ProdID as 'Product ID', Prod as Products from Inventory

How do you copy a database table in SQL using code?

Open Query analyser
Select the required database (Use [databasename])

Type :

SELECT * INTO MyNewTable FROM MyTable

e.g SELECT * INTO Customer2 FROM Customer

Hide System Tables and Objects in MS SQL 2000 Enterprise Manager

Recently I have been working with SQL tables and stored procedures in Enterprise Manager. By default, the system and stored procedures are visible along with user-defined ones which make it fairly inconvenient when you are only interested in your own tables and stored procedures.

To make life a bit easier I thought I would find a way of hiding the system objects. The instructions are as follows :

1.  Right click on the "(Local)(WindowsNT)" in the Enterprise Manager.
2.  Select "Edit SQL Server Registration Properties," which opens up a property panel.
3.  Uncheck the option "Show system databases and system obejcts."
4.  Click OK