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 |
|
123apple
Starting Member
2 Posts |
Posted - 2008-07-13 : 22:42:23
|
| I would like to add a new column to a table that takes the information from another column and subtracts 10% from that number. The following is what I have so far. I don't know how to complete the trigger statement to set the information from the other row. Additionally, I want to make the default value of the new column pListPrice -10%. Any ideas would be much appreciated! Thanks!ALTER TABLE products ADD a_price DOUBLE DEFAULT (SELECT pListPrice FROM products ;CREATE TRIGGER t_products BEFORE UPDATE ON products FOR EACH ROW SET |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-07-13 : 22:50:42
|
are you using Microsoft SQL Server ?SQL Server does not support BEFORE UPDATE KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-07-13 : 22:55:38
|
| It's not for sql server, since there is no double data type in sql server. |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-07-13 : 22:58:43
|
| We use double data type in sybase. |
 |
|
|
123apple
Starting Member
2 Posts |
Posted - 2008-07-13 : 23:55:16
|
| I'm sorry: I'm not sure what server I use, but I can use a double data type so it must not be a Windows server. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-07-13 : 23:59:57
|
You will need to find out what database server are you using and post in the appropriate forum. FYI this is a Microsoft SQL Server forum. Try dbforums.com KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|