Thursday, February 16, 2012

Adding data to columns

Hi

I'm am using SQL Server 2005 Express on my home PC.

To practice some of the SQL skills I learned on a course I was recently on, I am trying to build a mini database which I can run some queries from.

I have created some tables and added columns to these tables. However, I cannot find how to add data to these columns.

I'm sure it's pretty simple but I just can't find it! Can anyone help?

Cheers!

Hi,

use http://www.microsoft.com/downloads/details.aspx?FamilyID=82afbd59-57a4-455e-a2d6-1d4c98d40f6e&DisplayLang=en

to do this with an administrative console, otherwise, code you own gui to put in the appropiate statements.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de
|||

MarkAdams,

If you want to practice SQL "by hand", you can use an insert instruction. For example :

INSERT INTO Members (Id, FirstName)

VALUES (1, 'Mike');

In this example, we have a table Members which contains 2 columns : Id and FirstName). The values to insert must be appear in the exact same order as the columns names listed.

If Id is an identity column used as a primary key, you don't enter any value by hand. So the insert instruction will look like :

INSERT INTO Members (FirstName)

VALUES ('Mike');

The SQL Server 2005 Management Studio Express application is a good tool to learn SQL, because you can use both graphical and script method to execute instructions.

Best regards.

No comments:

Post a Comment