![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Maybe some one can help me... I have 2 tables with the following structure: CREATE TABLE [table1]( [GRID] [int] IDENTITY (1, 1) NOT NULL , [GID] [varchar] (10) NOT NULL , [RID] [int] NOT NULL ) On primary CREATE TABLE [table2] ( [RID] [int] IDENTITY (1, 1) NOT NULL , [RText] [varchar] (400) NULL ) ON [PRIMARY] If [RID] in table 1 exists more then one time (the first occurence leave as is) and then create a new [RID] every time it is found in table2 with the RText from [RID] and update table1 with applicable [RID] . |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
I hope this helps: Before Update: table1: [GRID] [GID] [RID] 102 2 1 103 3 1 table2: [RID] [RText] 1 Rtext After Update: table1: [GRID] [GID] [RID] 102 2 1 103 3 2 table2: [RID] [RText] 1 Rtext 2 Rtext |
#5
| |||
| |||
|
|
-----Original Message----- What is the logic you're using here? And what are your keys? Table2 appears to not have a primary key at all..? -- Adam Machanic SQL Server MVP http://www.sqljunkies.com/weblog/amachanic -- "anonymous" <anonymous (AT) discussions (DOT) microsoft.com> wrote in message news:137001c50ee6$4786ca10$a601280a (AT) phx (DOT) gbl... I hope this helps: Before Update: table1: [GRID] [GID] [RID] 102 2 1 103 3 1 table2: [RID] [RText] 1 Rtext After Update: table1: [GRID] [GID] [RID] 102 2 1 103 3 2 table2: [RID] [RText] 1 Rtext 2 Rtext . |
![]() |
| Thread Tools | |
| Display Modes | |
| |