Merge Replication for new created tables - sql-server-2008-r2

I have two SQL Server 2008 R2 Standard servers and they are using merge replication, sometimes new tables are created in the subscriber and I want it to be replicated to the publisher.
Is there an option in SQL Server that allows me to replicate the new created table to the publisher or I have to make my custom procedure to do this.
If you have other suggestion (Like use something else other merge replication) you are welcome
Note: some clients are connected to the subscriber and others to the publisher and no I can't shift all the clients to the publisher.

steps are the following:
Create the table on the publisher
Add the table to the publication (sp_addmerge... - I forgot!)
recreate the snapshot
restart subscription
The suscriber will then be updated with the latest additions in the snapshot: only the new table(s) will be sent to the suscriber.
It you still need some help ....

Related

Tableau Dashboard Templating

How can we make the Tableau dashboard templated? We would like to create just the template/wireframe of our reports and as the client requests we should be able to fetch that specific data and generate the report and display it to the client on tableau embedded-web?
There isn't a good way to do this, but there are some hacky workarounds.
Option 1: Separate DB Servers for each Client, Same Schema
If each client has a separate database server with the same schema, you can use the Tableau Server REST API to duplicate the workbook and data source for each client, then use the Update Data Source Connection endpoint to change the database server the data source points to to the new client's.
Option 2: Same Database Server and Schema
Create a column in your database table named 'client' and set it to the client's ID or client's name in all of your rows
Create a parameter in your Tableau workbook named "Client"
When connecting to the database and table in Tableau, you can use a custom SQL statement such as:
SELECT * FROM table WHERE client=<Parameters.Client>
Once you have the workbook loaded, you can use the JS API method Workbook.changeParameterValueAsync() method to set the Client parameter to the appropriate client ID
This has some critical security issues: If the user is able to figure out the client ID of another client, they can get their data. They can also brute force this by calling changeParameterValueAsync themselves.

SQL server replication over replication

I have the following scenario :
-Server 1 have a data_server1 data base and a transactional publication (over internet) called TANS_PUB (9 tables article)
-Server 2 is a subscriber for TANS_PUB and have a local data base "data_server2"
Note: data_server1 and data_server2 have the same structure (schema)
and the trans replication work very well
Now in server2 i created a merge publication (over internet and for all tables as articles) called MERG_PUB and i make server1 a subcriber to it. this merge pub is from data_server2 to data_server1_2 in server1. this replication also work very well.
the problem is :
if one of the 9 table (in server1) (exemple TAB1), is updated manualy or by program, TAB1 in server2 is updated (by the replication based on TANS_PUB), but TAB1 in data_server1_2 (server1) is not update :-( ( in this case the MERG_PUB is not working), note if i update TAB1 in server2 manualy or by program TAB1 in data_server1_2 (server1) is well updated !!!!!
Can you help please ????
1000 thanks
It sounds like you are utilizing the republisher model with both Transactional and Merge Replication and updates originating upstream are not making it all the way downstream. In this model, by default, the Distribution Agent does not fire the Merge triggers when performing inserts/updates/deletes, and as a result the changes are not recorded in the Merge tracking tables so they never get replicated to the Merge subscribers.
To alleviate this problem please set the Merge article property #published_in_tran_pub to true for all Merge articles participating in the Transactional publication.
USE MergePublicationDB
EXEC sp_changemergearticle
#publication = 'MergePublicationName',
#article = 'MergeArticleName',
#property = N'published_in_tran_pub',
#value = N'true'
GO

Why doesn't mirth recognize the changes I have made to my channel?

I added a database writer destination to a working mirth channel. The destination is not writing to the table like it is supposed to, but it is not generating errors on the dashboard. I'm not really sure how to get it to work.
Here are the steps I have taken so far:
changed the name of the table to a non-existing table // Does not generate error, suggesting that it does not even recognize the destination
validator connector (successful)
verified username/pw/URL are correct (I even cloned a working database writer from the same channel to try to get it to run)
removed all filters (in case it was filtering for some reason)
cloned the same transformer used in another working destination from the same channel
allowed nulls in the SQL server database in case it was trying to insert nulls
disabled/enabled channels. Started/restarted mirth. Opened/closed SQL server
I am not really sure what else there is to do. Any suggestions?
You have to click deploy all channels in the channels menu in order for mirth to launch the modified version of a channel after you make changes to it. Then you may have to start all channels in the dashboard too. That got my channel working

Can Sync Services add a column on the central table?

Is it possible to have Sync Services for ADO.NET read data from a table on multiple devices and insert it into a central SQL Server, having an additional column in the central table with the origin of the row data?
Let's say I have equipped door-to-door sales people with a device where they register sales. The local table would contain rows with sales information, and the central database would contain the same data + a column with the ID of the sales person.
Is that possible, or would I need the sales person's ID in the local database too?
Sync Framework identifies each client with a GUID (see: How To:Use Session Variables) and you can use that to map a particular client to a particular salesperson (see:Identifying Which Client Made a Data Change on either How to: Use Custom Change Tracking System or How to: Use SQL Server Change Tracking.
Or try the approach here for intercepting the change dataset and inserting/substituting the salesperson value: Part 1 – Upload Synchronization where the Client and Server Primary Keys are different

How to subscribe to KDB RDB Table?

I have a table t which is being updated in KDB in realtime. I want a query which does the subscription to the table?
Thanks.
Is it the classic tick.q setup?
If so, the following will work where h is the handle to the tickerplant, t is the table name and s is the subset of symbols that you wish to subscribe to:
/ subscribe and initialize
$[`~t;(upd .)each;(upd .)]h(".u.sub";t;s);
The above is from c.q: https://github.com/KxSystems/kdb/blob/master/tick/c.q
If both pub/sub services need to be set up you can follow tick.q as an example of how it can be done:
https://code.kx.com/q/tutorials/startingq/tick/