I'm trying to add a formula to a column in a Table, in Enterprise Manager,
but I'm not being allowed.
I want a column to be multiplication of two other columns, datatypes money
and decimal.
I'm typing SubTotal * TaxRate ...
What's the big deal with this?
Hi Calvin
As per my knowledge you cannot add formula to the table. You can do this in
your query.
If u feel you use the formula frequently, u can create a VIEW of UDF
Hope this will solve your problem.
Thanks and regards
Chandra
"Calvin" wrote:
> I'm trying to add a formula to a column in a Table, in Enterprise Manager,
> but I'm not being allowed.
> I want a column to be multiplication of two other columns, datatypes money
> and decimal.
> I'm typing SubTotal * TaxRate ...
> What's the big deal with this?
>
>
|||Try using Query Analyzer and execute the CREATE TABLE statement instead, then you can post an error
message for us. Below work fine on my machine:
CREATE TABLE #t
(subtotal decimal(5,3)
,taxrate int
,x AS subtotal*taxrate)
An alternative is to present derived information in views instead of in the table...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Calvin" <calvin@.discussions.microsoft.com> wrote in message
news:BE975F7D.1622%calvin@.discussions.microsoft.co m...
> I'm trying to add a formula to a column in a Table, in Enterprise Manager,
> but I'm not being allowed.
> I want a column to be multiplication of two other columns, datatypes money
> and decimal.
> I'm typing SubTotal * TaxRate ...
> What's the big deal with this?
>
|||Yeah... realized that would save the hassle after my post. Thanks for your
reply.
On 29/4/05 7:06 am, in article
5042C552-DDBF-4D63-BE77-C8B6ECDAF946@.microsoft.com, "Chandra"
<Chandra@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
> Hi Calvin
> As per my knowledge you cannot add formula to the table. You can do this in
> your query.
> If u feel you use the formula frequently, u can create a VIEW of UDF
> Hope this will solve your problem.
> Thanks and regards
> Chandra
>
> "Calvin" wrote:
|||Decided to change the query which updates the table instead, but thanks fr
your reply.
On 29/4/05 9:19 am, in article O6qYcQJTFHA.3056@.TK2MSFTNGP14.phx.gbl, "Tibor
Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote:
> Try using Query Analyzer and execute the CREATE TABLE statement instead, then
> you can post an error
> message for us. Below work fine on my machine:
> CREATE TABLE #t
> (subtotal decimal(5,3)
> ,taxrate int
> ,x AS subtotal*taxrate)
> An alternative is to present derived information in views instead of in the
> table...
Showing posts with label formula. Show all posts
Showing posts with label formula. Show all posts
Saturday, February 25, 2012
Add Formula for a column
Add Formula for a column
I'm trying to add a formula to a column in a Table, in Enterprise Manager,
but I'm not being allowed.
I want a column to be multiplication of two other columns, datatypes money
and decimal.
I'm typing SubTotal * TaxRate ...
What's the big deal with this?Hi Calvin
As per my knowledge you cannot add formula to the table. You can do this in
your query.
If u feel you use the formula frequently, u can create a VIEW of UDF
Hope this will solve your problem.
Thanks and regards
Chandra
"Calvin" wrote:
> I'm trying to add a formula to a column in a Table, in Enterprise Manager,
> but I'm not being allowed.
> I want a column to be multiplication of two other columns, datatypes money
> and decimal.
> I'm typing SubTotal * TaxRate ...
> What's the big deal with this?
>
>|||Try using Query Analyzer and execute the CREATE TABLE statement instead, the
n you can post an error
message for us. Below work fine on my machine:
CREATE TABLE #t
(subtotal decimal(5,3)
,taxrate int
,x AS subtotal*taxrate)
An alternative is to present derived information in views instead of in the
table...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Calvin" <calvin@.discussions.microsoft.com> wrote in message
news:BE975F7D.1622%calvin@.discussions.microsoft.com...
> I'm trying to add a formula to a column in a Table, in Enterprise Manager,
> but I'm not being allowed.
> I want a column to be multiplication of two other columns, datatypes money
> and decimal.
> I'm typing SubTotal * TaxRate ...
> What's the big deal with this?
>|||Yeah... realized that would save the hassle after my post. Thanks for your
reply.
On 29/4/05 7:06 am, in article
5042C552-DDBF-4D63-BE77-C8B6ECDAF946@.microsoft.com, "Chandra"
<Chandra@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
> Hi Calvin
> As per my knowledge you cannot add formula to the table. You can do this
in
> your query.
> If u feel you use the formula frequently, u can create a VIEW of UDF
> Hope this will solve your problem.
> Thanks and regards
> Chandra
>
> "Calvin" wrote:
>|||Decided to change the query which updates the table instead, but thanks fr
your reply.
On 29/4/05 9:19 am, in article O6qYcQJTFHA.3056@.TK2MSFTNGP14.phx.gbl, "Tibor
Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote:
> Try using Query Analyzer and execute the CREATE TABLE statement instead, t
hen
> you can post an error
> message for us. Below work fine on my machine:
> CREATE TABLE #t
> (subtotal decimal(5,3)
> ,taxrate int
> ,x AS subtotal*taxrate)
> An alternative is to present derived information in views instead of in th
e
> table...
but I'm not being allowed.
I want a column to be multiplication of two other columns, datatypes money
and decimal.
I'm typing SubTotal * TaxRate ...
What's the big deal with this?Hi Calvin
As per my knowledge you cannot add formula to the table. You can do this in
your query.
If u feel you use the formula frequently, u can create a VIEW of UDF
Hope this will solve your problem.
Thanks and regards
Chandra
"Calvin" wrote:
> I'm trying to add a formula to a column in a Table, in Enterprise Manager,
> but I'm not being allowed.
> I want a column to be multiplication of two other columns, datatypes money
> and decimal.
> I'm typing SubTotal * TaxRate ...
> What's the big deal with this?
>
>|||Try using Query Analyzer and execute the CREATE TABLE statement instead, the
n you can post an error
message for us. Below work fine on my machine:
CREATE TABLE #t
(subtotal decimal(5,3)
,taxrate int
,x AS subtotal*taxrate)
An alternative is to present derived information in views instead of in the
table...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Calvin" <calvin@.discussions.microsoft.com> wrote in message
news:BE975F7D.1622%calvin@.discussions.microsoft.com...
> I'm trying to add a formula to a column in a Table, in Enterprise Manager,
> but I'm not being allowed.
> I want a column to be multiplication of two other columns, datatypes money
> and decimal.
> I'm typing SubTotal * TaxRate ...
> What's the big deal with this?
>|||Yeah... realized that would save the hassle after my post. Thanks for your
reply.
On 29/4/05 7:06 am, in article
5042C552-DDBF-4D63-BE77-C8B6ECDAF946@.microsoft.com, "Chandra"
<Chandra@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
> Hi Calvin
> As per my knowledge you cannot add formula to the table. You can do this
in
> your query.
> If u feel you use the formula frequently, u can create a VIEW of UDF
> Hope this will solve your problem.
> Thanks and regards
> Chandra
>
> "Calvin" wrote:
>|||Decided to change the query which updates the table instead, but thanks fr
your reply.
On 29/4/05 9:19 am, in article O6qYcQJTFHA.3056@.TK2MSFTNGP14.phx.gbl, "Tibor
Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote:
> Try using Query Analyzer and execute the CREATE TABLE statement instead, t
hen
> you can post an error
> message for us. Below work fine on my machine:
> CREATE TABLE #t
> (subtotal decimal(5,3)
> ,taxrate int
> ,x AS subtotal*taxrate)
> An alternative is to present derived information in views instead of in th
e
> table...
Add Formula for a column
I'm trying to add a formula to a column in a Table, in Enterprise Manager,
but I'm not being allowed.
I want a column to be multiplication of two other columns, datatypes money
and decimal.
I'm typing SubTotal * TaxRate ...
What's the big deal with this?Hi Calvin
As per my knowledge you cannot add formula to the table. You can do this in
your query.
If u feel you use the formula frequently, u can create a VIEW of UDF
Hope this will solve your problem.
Thanks and regards
Chandra
"Calvin" wrote:
> I'm trying to add a formula to a column in a Table, in Enterprise Manager,
> but I'm not being allowed.
> I want a column to be multiplication of two other columns, datatypes money
> and decimal.
> I'm typing SubTotal * TaxRate ...
> What's the big deal with this?
>
>|||Try using Query Analyzer and execute the CREATE TABLE statement instead, then you can post an error
message for us. Below work fine on my machine:
CREATE TABLE #t
(subtotal decimal(5,3)
,taxrate int
,x AS subtotal*taxrate)
An alternative is to present derived information in views instead of in the table...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Calvin" <calvin@.discussions.microsoft.com> wrote in message
news:BE975F7D.1622%calvin@.discussions.microsoft.com...
> I'm trying to add a formula to a column in a Table, in Enterprise Manager,
> but I'm not being allowed.
> I want a column to be multiplication of two other columns, datatypes money
> and decimal.
> I'm typing SubTotal * TaxRate ...
> What's the big deal with this?
>|||Decided to change the query which updates the table instead, but thanks fr
your reply.
On 29/4/05 9:19 am, in article O6qYcQJTFHA.3056@.TK2MSFTNGP14.phx.gbl, "Tibor
Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote:
> Try using Query Analyzer and execute the CREATE TABLE statement instead, then
> you can post an error
> message for us. Below work fine on my machine:
> CREATE TABLE #t
> (subtotal decimal(5,3)
> ,taxrate int
> ,x AS subtotal*taxrate)
> An alternative is to present derived information in views instead of in the
> table...|||Yeah... realized that would save the hassle after my post. Thanks for your
reply.
On 29/4/05 7:06 am, in article
5042C552-DDBF-4D63-BE77-C8B6ECDAF946@.microsoft.com, "Chandra"
<Chandra@.discussions.microsoft.com> wrote:
> Hi Calvin
> As per my knowledge you cannot add formula to the table. You can do this in
> your query.
> If u feel you use the formula frequently, u can create a VIEW of UDF
> Hope this will solve your problem.
> Thanks and regards
> Chandra
>
> "Calvin" wrote:
>> I'm trying to add a formula to a column in a Table, in Enterprise Manager,
>> but I'm not being allowed.
>> I want a column to be multiplication of two other columns, datatypes money
>> and decimal.
>> I'm typing SubTotal * TaxRate ...
>> What's the big deal with this?
>>
but I'm not being allowed.
I want a column to be multiplication of two other columns, datatypes money
and decimal.
I'm typing SubTotal * TaxRate ...
What's the big deal with this?Hi Calvin
As per my knowledge you cannot add formula to the table. You can do this in
your query.
If u feel you use the formula frequently, u can create a VIEW of UDF
Hope this will solve your problem.
Thanks and regards
Chandra
"Calvin" wrote:
> I'm trying to add a formula to a column in a Table, in Enterprise Manager,
> but I'm not being allowed.
> I want a column to be multiplication of two other columns, datatypes money
> and decimal.
> I'm typing SubTotal * TaxRate ...
> What's the big deal with this?
>
>|||Try using Query Analyzer and execute the CREATE TABLE statement instead, then you can post an error
message for us. Below work fine on my machine:
CREATE TABLE #t
(subtotal decimal(5,3)
,taxrate int
,x AS subtotal*taxrate)
An alternative is to present derived information in views instead of in the table...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Calvin" <calvin@.discussions.microsoft.com> wrote in message
news:BE975F7D.1622%calvin@.discussions.microsoft.com...
> I'm trying to add a formula to a column in a Table, in Enterprise Manager,
> but I'm not being allowed.
> I want a column to be multiplication of two other columns, datatypes money
> and decimal.
> I'm typing SubTotal * TaxRate ...
> What's the big deal with this?
>|||Decided to change the query which updates the table instead, but thanks fr
your reply.
On 29/4/05 9:19 am, in article O6qYcQJTFHA.3056@.TK2MSFTNGP14.phx.gbl, "Tibor
Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote:
> Try using Query Analyzer and execute the CREATE TABLE statement instead, then
> you can post an error
> message for us. Below work fine on my machine:
> CREATE TABLE #t
> (subtotal decimal(5,3)
> ,taxrate int
> ,x AS subtotal*taxrate)
> An alternative is to present derived information in views instead of in the
> table...|||Yeah... realized that would save the hassle after my post. Thanks for your
reply.
On 29/4/05 7:06 am, in article
5042C552-DDBF-4D63-BE77-C8B6ECDAF946@.microsoft.com, "Chandra"
<Chandra@.discussions.microsoft.com> wrote:
> Hi Calvin
> As per my knowledge you cannot add formula to the table. You can do this in
> your query.
> If u feel you use the formula frequently, u can create a VIEW of UDF
> Hope this will solve your problem.
> Thanks and regards
> Chandra
>
> "Calvin" wrote:
>> I'm trying to add a formula to a column in a Table, in Enterprise Manager,
>> but I'm not being allowed.
>> I want a column to be multiplication of two other columns, datatypes money
>> and decimal.
>> I'm typing SubTotal * TaxRate ...
>> What's the big deal with this?
>>
Sunday, February 19, 2012
Add column to table
Hi everybody.
Does anyone know if it is possible to add a formula field as column of a
replicated table?
How can I do it?
Thanks,
Marco
You can add a formula column the same as would if you added a non-formula
column to a published table. See BOL topic Schema Changes on Publication
Databases for more details.
To add columns to an article
1. In SQL Server Enterprise Manager, under Replication, expand Publications
and then right-click the publication where you want to modify a schema.
2. Click Properties, click Filter Columns, and then click Add Column.
3. In the Add Column to Replicated Table dialog box, enter the name of the
column and the SQL syntax that defines the column. For example if I want
to add a new formula column with a value of 10 greater than an existing
column col1, the SQL syntax should be: "AS ([col1] + 10)" . (For
information about the syntax required to define the column, see the
Transact-SQL ALTER TABLE statement)
4. In the Add Column to Replicated Table dialog box, select the
publications to which you want to add the column.
Fany Vargas
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? For information about the Strategic Technology Protection
Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.
Microsoft highly recommends that users with Internet access update their
Microsoft software to better protect against viruses and security
vulnerabilities. The easiest way to do this is to visit the following
websites:
http://www.microsoft.com/protect
http://www.microsoft.com/security/guidance/default.mspx
|||Try something like:
sp_repladdcolumn @.source_object = 'tablename',
@.column = 'columnname',
@.typetext = ' as (ID + 1)'
I just used this on a test system where ID is an existing column and it was
added on the publisher and subscriber (through synchronization) fine.
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
Does anyone know if it is possible to add a formula field as column of a
replicated table?
How can I do it?
Thanks,
Marco
You can add a formula column the same as would if you added a non-formula
column to a published table. See BOL topic Schema Changes on Publication
Databases for more details.
To add columns to an article
1. In SQL Server Enterprise Manager, under Replication, expand Publications
and then right-click the publication where you want to modify a schema.
2. Click Properties, click Filter Columns, and then click Add Column.
3. In the Add Column to Replicated Table dialog box, enter the name of the
column and the SQL syntax that defines the column. For example if I want
to add a new formula column with a value of 10 greater than an existing
column col1, the SQL syntax should be: "AS ([col1] + 10)" . (For
information about the syntax required to define the column, see the
Transact-SQL ALTER TABLE statement)
4. In the Add Column to Replicated Table dialog box, select the
publications to which you want to add the column.
Fany Vargas
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? For information about the Strategic Technology Protection
Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.
Microsoft highly recommends that users with Internet access update their
Microsoft software to better protect against viruses and security
vulnerabilities. The easiest way to do this is to visit the following
websites:
http://www.microsoft.com/protect
http://www.microsoft.com/security/guidance/default.mspx
|||Try something like:
sp_repladdcolumn @.source_object = 'tablename',
@.column = 'columnname',
@.typetext = ' as (ID + 1)'
I just used this on a test system where ID is an existing column and it was
added on the publisher and subscriber (through synchronization) fine.
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
Subscribe to:
Posts (Atom)