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

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Setting multiple columns equal to the identity column

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-07-30 : 09:43:27
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
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-07-30 : 10:17:40
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
   

- Advertisement -