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 procedure

Author  Topic 

killerking
Starting Member

3 Posts

Posted - 2002-12-11 : 15:00:34
Hello, I'm new to this community, I'm posting here as I need help ASAP and I think it's rather simple but I don't know how to write a procedure for it.

I need a SQL 2000 Server transact procedure which UPDATEs a field in each row in a 2 millon rows table.
This field must be updated with a string ending with a number incrementing by 1 on each row.

Thanks for any help, it would be highly appreciated.

--
Manuel Razzari
kllk@cyberjunkie.com
http://www.ultimorender.com.ar/funkascript

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-12-11 : 15:26:48
Can you provide more specifics on the alphabetic part of the column? Is there any reason why you need to store the data that way? If the alpha part is fixed (i.e. AAA0123, AAA0124) then there's no point in storing it in the table itself.

Go to Top of Page

killerking
Starting Member

3 Posts

Posted - 2002-12-11 : 15:37:35
Hello, thanks for answering.

The alpha part must be stored in the table because it's an e-mail address (i.e. 111234@domain.com, 111235@domain.com) and the table will be used by external provider.

Thanks again,
- Manuel
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2002-12-11 : 15:43:40
Here's an idea,
Either temporarly or permentily put an Identity field on the table. Then you could do something like this:

 
UPDATE myTable
SET myEmailAddressField = myIdentityField + '@domain.com'


Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

killerking
Starting Member

3 Posts

Posted - 2002-12-11 : 16:48:06
Hello Michael. Your suggestion did work.

I thought I'd have to use a loop to generate the numbers. Your suggestion worked just fine and today we'll be able to go home before midnight thanks to your help and rob's ;)

Now I see it, UPDATE myTable SET Email = ID + '@domain.com'
it was a rather plain UPDATE, we didn't even needed transact procedures, but our minds simply weren't making the right connections. Duh...

Thanks again. Best,
- Manuel Razzari
Go to Top of Page
   

- Advertisement -