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 |
|
rjhe22
Constraint Violating Yak Guru
283 Posts |
Posted - 2010-06-17 : 12:37:04
|
hi i have to delete wrong entries frm three different table i was asked to do it the way i have it done but am wondering if this code makes sense and if it looks like its right( @bankImportID uniqueidentifier @valuationPriceID uniqueidentifier)AS--bank import journal levelDECLARE @tbl TABLE( BankImportID uniqueidentifier , ValuationPriceID uniqueidentifier ) INSERT INTO @tbl( BankImportID )SELECT bijFROM dbo.BankImportJournal bijWHERE bij.BankImportID = @bankImportIDINSERT INTO @tbl( ValuationPriceID )SELECT vpFROM dbo.ValuationPrice vpWHERE vp.ValuationPriceID = @valuationPriceID--Delete bank import--JournalDELETE bijFROM dbo.BankImportJournal bijINNERJOIN @tbl tON t.BankImportID = bij.BankImportID-- delete from bank import logDELETE bilFROM dbo.BankImportLogWHERE BankImportID = @bankImportIDDELETE vpFROM dbo.ValuationPrice WHERE ValuationPriceID = @valuationPriceID |
|
|
rjhe22
Constraint Violating Yak Guru
283 Posts |
Posted - 2010-06-17 : 13:05:55
|
| anyone any idea need to get this finished this evening |
 |
|
|
|
|
|