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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Update column if there are revisions

Author  Topic 

slboytoy
Starting Member

30 Posts

Posted - 2005-03-23 : 12:46:28
I'm trying to update a column, if the number is or has a revision. I've been playing around all morning. I can do it with activeX, but that would be a performance hit I beleive. Would be nice if T-SQL could do this.

1000
1005
1030
1055
1055R1
1055R2
1060
1089
1089R1
1090
1096

-- R means revision --
Covert to...

1000
1005
1030
1055      Y
1055R1   Y
1055R2
1060
1089      Y
1089R1
1090
1096


Here is what I have played with.

1. Group by Substring(number, 0, 5) or Len(number > 5) or Substring(number, 5, 1) = 'R'
2. Counts that are bigger then one, you know there is more then one record. use results to update columns to 'Y'
3. use max(number) to find the most current number and set the column back to blank.

PW
Yak Posting Veteran

95 Posts

Posted - 2005-03-23 : 13:12:32
This is what happens when you throw normalization out the window in db design.
You have a "number" (1 piece of data) and a revision number to it (a separate piece of data). These should be in 2 separate columns, not in a concatenated column with overloaded meanings depending on presence of an 'R' at a certain location.
Go to Top of Page

slboytoy
Starting Member

30 Posts

Posted - 2005-03-30 : 12:24:15
I want to add a revision indicator.

1
2
3
3R1
3R2
4
5

Those are my 7 quote numbers. 3 was the first quote, there was a revision on it. (3R1). And there was a revision on 3R1 (3R2). The rest don't have any revision, they are the latest quotes numbers.

So I want to add a flag on 3 and 3R1 to say they are revision.


Does that Help ?
Go to Top of Page
   

- Advertisement -