You are here: Re: Syntax to add records if primary key = list « MsSQL Server « IT news, forums, messages
Re: Syntax to add records if primary key = list

Posted by Erland Sommarskog on 09/22/05 00:29

tom (tomfeldsten@hotmail.com) writes:
>From a list of IDs that are the primary key in one table (i.e. Customer
> Table), I want to make changes in tables that use those IDs as a
> foreign key.
>
> Basically I want to say:
>
> If fk_ID is in list [1,2,3,4,5] then
> do these statements to that record
> End if
>
> Where do I begin?
>
> Thanks for help with this low-level view of SQL programming.

IF EXISTS (SELECT * FROM tbl WRE fk_ID IN (1, 2,3, 4, 5))

Although I'm really certain that I understood exactly what you want to
do, so you maybe you need t clarify.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация