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 |
TallOne
Starting Member
49 Posts |
Posted - 2007-02-19 : 10:04:14
|
Hi All,I have a replicated database that is a really big pain to change table structure so I use the stored procedures to do this.exec sp_repladdcolumn @source_object = 'tblMyTableName', @column = 'CubicFt', @typetext = 'real ', @publication_to_add = 'MyDatabase'Here's the problem:The field is calculated and has a value in it's Formula properties such as ([fieldW] * [fieldH] * [fieldL] * [Qty])How do I use the SP syntax to add this field to the database??? |
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2007-02-19 : 10:38:29
|
You'll need to use dynamic SQL - take a look at EXECUTE and sp_executesql in Books Online. |
 |
|
TallOne
Starting Member
49 Posts |
Posted - 2007-02-19 : 11:24:35
|
Ok..I'm looking and I see where we can build and execute a SQL statement dynamically but I don't see where this helps with the syntax of the replication sp. Am I missing something? Am I assuming correctly that the replication stored procedure handles things differently than adding columns using Transact SQL?Thanks In AdvanceTallOne |
 |
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2007-02-19 : 13:52:28
|
I'm sorry, I read your question too quickly, try thisexec sp_repladdcolumn @source_object = 'tblMyTableName', @column = 'CubicFt', @typetext = N'as ([fieldW] * [fieldH] * [fieldL] * [Qty])', @publication_to_add = 'MyDatabase'Also, note the following from Books Online "Timestamp and computed columns will be filtered out for character mode publications. If adding a timestamp or computed column using sp_repladdcolumn, subscriptions of such publications will not receive this new column." |
 |
|
TallOne
Starting Member
49 Posts |
Posted - 2007-02-19 : 15:12:58
|
Thanks for the help. That worked! Also thanks for the note, we are running Native SQL Server format so there shouldn't be an issue.Again,THANK YOU snSQL! |
 |
|
|
|
|
|
|