Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 31st, 2005, 12:15 PM
Authorized User
 
Join Date: Feb 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to deniscuba
Default Trigger in SQL Server 2000

I have the follow stiuation:
Suposes that exits a DataBase with 2 Tables
Table A
ID varchar(50) PK
Description varchar(200)

Table B
ID1 varchar(50) PK FK(References to column ID in Table A)
ID2 varchar(50) PK FK(References to column ID in Table A)

and I want updating the column ID of Table A for cascade action using Triggers only
Who can helpme?


 
Old March 31st, 2005, 05:22 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Why do you want to use triggers when referential integrity will do it for you?

 
Old March 31st, 2005, 05:47 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes..Foreign Key and in SQL Server 2000 (I think not in SQL 7) you can set to cascade update. Triggers are only needed when you need to implement referential integrity across SQL database servers

 
Old April 1st, 2005, 10:57 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

  I saw that you IMd me on Yahoo, but I couldn't respond. I think the error you are getting is because you have the ID from table one, linked to 2 FKs in table 2. Why would you have this structure?
 
Old April 1st, 2005, 11:37 AM
Authorized User
 
Join Date: Feb 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to deniscuba
Default

For jbenson001:
I have a Table where storage the parameters that can be defined by users, and this parameters are classified in simples or complex. The Table A storage all parameters defined by users without its relations; and the Table B the storage relations into parameters for example:
- User1 define following parameters:
param1 (simple)
param2 (simple)
- User2 define following parameters:
param3 (complex), and formed by
 i) param1
 ii) param2
- User3 define following parameters:
param4 (complex), and formed by
 i) param 2
 ii)param 3

therefore i need this scheme of tables and Sql Server 2000 not allow me set up both ntegrity referencial with cascade update action, in order to obtain this behaivor i see the TRIGGERs like solution






Similar Threads
Thread Thread Starter Forum Replies Last Post
Trigger Problem in sql server monika.vasvani SQL Language 1 March 1st, 2007 07:09 AM
SQL Server 2000 and SQL Server 2000 CE dparsons SQL Server 2000 1 July 31st, 2006 12:59 PM
looking for access 2000 to sql server 2000 sql/que method SQL Server 2000 0 July 7th, 2005 12:46 PM
SQL SERVER 2000 AND ACCESS 2000 ckentebe SQL Server 2000 3 June 17th, 2004 08:50 PM
SQl Server 2000 Trigger everest SQL Server 2000 5 April 26th, 2004 01:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.