You are here: Re: delete of mirrored rows « MsSQL Server « IT news, forums, messages
Re: delete of mirrored rows

Posted by Jeff Kish on 10/01/35 11:29

On 6 Oct 2005 01:00:14 -0700, "David Portas"
<REMOVE_BEFORE_REPLYING_dportas@acm.org> wrote:

>What is the key of this table? Please post proper DDL so that we don't
>have to guess. I'm going to assume that the combination of all three
>columns is unique, in which case try this:
>
>DELETE FROM tbl
> WHERE EXISTS
> (SELECT *
> FROM tbl AS T
> WHERE T.table_name_start = tbl.table_name_end
> AND T.table_name_end = tbl.table_name_start
> AND T.column_name = T.column_name)
> AND table_name_start > table_name_end ;
>
>--
>David Portas
>SQL Server MVP
David,
Very sorry but I did not realize that would make a difference. (really
I didn't).
There actually was not a primary key (this was a temporary working
table).
I've put a primary key into place now, but I used the script before
that.
It seemed to work fine I've never used the 'AS' before.. I guess I
better study up a bit on it.
Oh.. the ddl was this:
CREATE TABLE [allEdges] (
[table_name_start] [varchar] (255) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[column_name] [varchar] (255) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL ,
[table_name_end] [varchar] (255) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO

 

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

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