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 |
|
Bob3242
Starting Member
4 Posts |
Posted - 2003-06-13 : 10:53:21
|
| I have devised a solution to my problem, however I do not know how to combine two attributes. I need to match IP Addresses and Error IDs for specific machines.My solution is to create a new attribute with the two fields combined.IP Address:Error ID (10.8.8.12:343). Currently these fields are in the same table. Can anyone tell me how to create add this new field?IP Address + ':' + Error IDThanks Bob |
|
|
dsdeming
479 Posts |
Posted - 2003-06-13 : 13:15:23
|
| Use a computed column. Here's an example from BOL:CREATE TABLE mytable ( low int, high int, myavg AS (low + high)/2 )However, there's really no need to build the computed column. You could always concatenate them on the fly.Dennis |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-06-13 : 14:12:15
|
| From what I can tell by your description, the table already exists but you need to add a new column then update the column based upon two other columns. I hope that I am correct on this.First add the column to the table, then get the data into the column:UPDATE Table1SET NewColumn = IPColumn + ':' + CONVERT(VARCHAR(50), ErrorIDColumn)Since I don't know what data types your columns are, I assumed that ErrorID column was int so it needs to be converted for the concatenation to work. I also assumed that IP column was already a string.Tara |
 |
|
|
|
|
|