Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi I am doing a project using V

Status
Not open for further replies.

darkradar

Programmer
Jul 20, 2002
78
US
Hi

I am doing a project using VB and SQL server.
I am maintaining the DB Server at my office and I will install the SQL client at the stores.
I had designed and creted the database already.
I am confused how to create primary keys for tables.
My idea is to take both storeID and S.no as Primary Key.
Because data will be coming and going from Both sides.
Its not network based. In the evening store connect to
internet and transfer data to the Server.
I had already created the Database. So if any body
can give me an idea how to solve this thing.
Can I update the Databse now.If I can,how can I update the
database???
Thanks in advance

 
You can have only one primary key per table, so I assume you are talking about a composite key. If the StoreID and Store No. taken together are unique, then you could use these. If either column will always contain unique values, then just set that column as the primary key. If both column will always contain unique values, then you could set a primary key on one and a unique constraint/unique index on the other column.

You can add Primary Keys after table creation:
Primary keys can be created from SQL Enterprise Manager by right-clicking the table and choosing properties, and clicking the Table and Index Properties button (looks like a hand with a piece of paper).
You can also set the primary keys from SQL Query Analyzer by using the ALTER TABLE statement like
Code:
ALTER TABLE dbo.Employees ADD CONSTRAINT PK_Employees PRIMARY KEY  CLUSTERED 
( EmployeeID )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top