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 |
|
carissa
Starting Member
3 Posts |
Posted - 2009-03-26 : 15:25:21
|
| this is a beginner question, how do I add a new field to my table? the datatype is doublealso, i need to remove a negative sign that precedes the number from a group of records. ltrim rtrim works for spaces, but what about characters? |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-03-26 : 15:35:56
|
| use ALTER TABLE and ADD COLUMN to add a new column.whats the data type of the field with the negatives |
 |
|
|
carissa
Starting Member
3 Posts |
Posted - 2009-03-26 : 15:39:45
|
| it is double |
 |
|
|
carissa
Starting Member
3 Posts |
Posted - 2009-03-26 : 15:46:21
|
| to add a column would i do this?alter table (name of table)add columnhow do i name it? do i need to specify the datatype? |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-03-26 : 16:24:15
|
Yes. You'd need to specify datatype. You can give anyname to it. Try avoiding sql keywords. e.g.ALTER TABLE yourtable ADD newcolumn VARCHAR(100) NULL There are many arguments to ALTER TABLE.Look in BOL if you have doubts. Its explained very well there. |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-03-26 : 16:27:59
|
| As for removing -ve sign, You can use ABS function. It'll return you the positive value of the expression. |
 |
|
|
|
|
|