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 |
|
GiriC
Starting Member
2 Posts |
Posted - 2006-02-28 : 12:02:57
|
| Hello, I have a cursor that opens all the records in a table. I need to generate a string like this "MSFT" + STATE + xx (can be ASCII sequence ) State ABBREVIATION comes from the cursor. How do I generate sequence like MSFTVA00 MSFTVA01 MSFTVA02 .............. MSFTVA09 MSFTVA0A MSFTVA0B......... MSFTVA0ZI can use only 2 spaces but I need to have as many distinct numbers in those last 2 spaces available Any ideas are appreciated. |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2006-02-28 : 13:27:45
|
| We can come up with a way to generate a sequence of (hex-like) characters but are you willing to think about alternative solutions? It is not a good strategy to concatenate multiple values along with a sequence (converted to characters) to act as a code or key. Can you use seperate columns to store the values and use a "natural" combination of these columns as the primary key (or unique) key? Alternatively, can you use an integer identity column to act as your sequence and the seperately store the other facts?Be One with the OptimizerTG |
 |
|
|
activecrypt
Posting Yak Master
165 Posts |
|
|
|
|
|