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.
| Author |
Topic |
|
zhshqzyc
Posting Yak Master
240 Posts |
Posted - 2008-07-23 : 12:14:02
|
| [code]IF NOT EXISTS (SELECT A FROM X WHERE A= '444444')BEGIN IF NOT EXISTS (SELECT 1 FROM Y WHERE U='888888') INSERT INTO Y (U,V,W,P,T) VALUES('888888','-1','-1','0','249.5')ENDELSEBEGIN IF EXISTS (SELECT 1 FROM Y WHERE U='888888') INSERT INTO Y (U,V,W,P,T) VALUES('888888','-1','-1','0','249.5')END[/code]Thanks for your help. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-23 : 12:50:56
|
| i dont think error is in posted code. can you post you full code please? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-23 : 13:03:57
|
You want the insert ONLY to happen if1) Table X AND Table Y does have record2) Table X AND Table Y doesn't have record E 12°55'05.25"N 56°04'39.16" |
 |
|
|
zhshqzyc
Posting Yak Master
240 Posts |
Posted - 2008-07-23 : 13:12:40
|
quote: Originally posted by Peso You want the insert ONLY to happen if1) Table X AND Table Y does have record2) Table X AND Table Y doesn't have record E 12°55'05.25"N 56°04'39.16"
Yeah. |
 |
|
|
zhshqzyc
Posting Yak Master
240 Posts |
Posted - 2008-07-23 : 13:12:40
|
quote: Originally posted by Peso You want the insert ONLY to happen if1) Table X AND Table Y does have record2) Table X AND Table Y doesn't have record E 12°55'05.25"N 56°04'39.16"
Yeah. |
 |
|
|
|
|
|
|
|