Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Setting multiple columns equal to the identity column
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

AskSQLTeam
Ask SQLTeam Question

USA
0 Posts

Posted - 07/30/2002 :  09:43:27  Show Profile  Visit AskSQLTeam's Homepage
steve writes "I am rather familiar (maybe not by your standards) with SQL, and am having a bit of a tough time with a simple thing. I have an identity column in a table called ID. I also have a column called CommonID. The commonID links certain records together.

Right now I have the commonID defaulting to 0. When a record is added, I have a stored procedure that sets the commonID to the ID. That stored procedure is called in an ASP page. However, I am worried that if a record is created some other way, the commonID won't be set to the ID, and when I go to display the desired records and its common ones, I will get all records with commonID of 0. This is bad.

I know stored procedures very well, but am clueless about triggers, and I think that's what I need to get this working. Can you show me how, or point me to a good reference?"

Page47
Flowing Fount of Yak Knowledge

USA
2878 Posts

Posted - 07/30/2002 :  10:17:40  Show Profile
Steve, I'm scratching my head wondering why you have two surrogate keys, both of which are candidate keys...

Can you post your ddl? Maybe CommonID should be a computed column?

Jay White
{0}
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.1 seconds. Powered By: Snitz Forums 2000