Connection between SAP Hana databases on different servers - hana

I have a structure of two hana database servers on different servers. I created a trigger on HDB1, which executes a procedure to insert data into another table, but this table is on another HDB2 server.
I'm consulting some possibilities via SDI and SDA, but I'm not sure how to make the connection between the databases, so that the HDB1 procedures can insert data into HDB2.

Related

SAP HANA: Temporary table not dropped automatically when connection pooling is enabled

I am using ADO.NET to connect SAP HANA database. I enable connection pooling in connection string like this: Server=hana-db:30015;Pooling=true;Max Pool Size=50;Min Pool Size=5;UserID=JSmith;Password=secret. But my problem is that, when I first connect to database and create a temporary table called #tbl, then disconnect without dropping #tbl. And when I reconnect to database, table #tbl still exists.
That doesn't happen when I set Pooling=false. So when Pooling=true, do I need manual drop temporary tables? Cause in MSSQL or Postgresql, temp tables dropped automatically when connection closed.
I believe in MSSQL it only drops the temp table on connection close when it's inside of a Stored Procedure. If your query is outside of a SP you will need to drop the temp tables yourself.

Syncing data between 2 SQL Server tables

I have 2 servers. One used for backup as well as sharing with other external users and the other for live queries internally.
At the moment, on the backup database, the existing table is dropped and new table is added using the below code:-
DROP TABLE [dbo].[test]
SELECT * INTO test FROM [remote server].[remote database].[dbo].[remote table];
Is there another method instead of dropping and adding tables. Ideally, something that looks for any changes and syncs them using SQL Server Management Studio.
Edit:
My server is Express Edition and remote is SQL Standard
If you want to sync two tables in simplex communication way(One Directional) then you should go with transaction replication.
Sync will be performed on transaction commit for particular row.

Multiple sessions on Stored Procedure in SQL Server

I have a stored procedure in SQL Server in which I am creating couple of temp tables within and manipulating them as per my business logic and at the end I’m deleting those temp tables by using drop table query in the procedure itself.
I have a question, if multiple users are operating at the same time the what will be the case of temp tables? Will it provide multiple instances as sessions in asp.net or only one instance will be available for all users?
Please suggest a good approach for this.
Local temporary tables:
are visible only to the current connection for the user, and they are
deleted when the user disconnects from the instance of SQL Server
If your ASP.NET application creates a separate connection for each user request, then each connection will have its own temporary tables - they won't be shared with other users.

using stored procedure to connect to db in external server

I have a stored procedure that updates a table taking the data from a source and I want to modify the stored procedure so that it takes data from a table in an external database and updates a table in the original server. Can this be achieved and how ?
See linked servers, it's treated just a synonym: http://msdn.microsoft.com/en-us/library/ff772782.aspx
Actually synonyms are treated like linked servers..

SQL 2005 : Master,modal,msdb,tempdb

I have question regarding sql system database that what purpose of these database of msdb and msdb.
Thanks in advance.
Check MSdn : System Databases and Data : http://msdn.microsoft.com/en-us/library/aa174522%28v=sql.80%29.aspx
Microsoft® SQL Server™ 2000 systems have four system databases:
* master
The master database records all of the system level information for a SQL Server system. It records all login accounts and all system configuration settings. master is the database that records the existence of all other databases, including the location of the database files. master records the initialization information for SQL Server; always have a recent backup of master available.
* tempdb
tempdb holds all temporary tables and temporary stored procedures. It also fills any other temporary storage needs such as work tables generated by SQL Server. tempdb is a global resource; the temporary tables and stored procedures for all users connected to the system are stored there. tempdb is re-created every time SQL Server is started so the system starts with a clean copy of the database. Because temporary tables and stored procedures are dropped automatically on disconnect, and no connections are active when the system is shut down, there is never anything in tempdb to be saved from one session of SQL Server to another.
By default, tempdb autogrows as needed while SQL Server is running. Unlike other databases, however, it is reset to its initial size each time the database engine is started. If the size defined for tempdb is small, part of your system processing load may be taken up with autogrowing tempdb to the size needed to support your workload each time to restart SQL Server. You can avoid this overhead by using ALTER DATABASE to increase the size of tempdb.
* model
The model database is used as the template for all databases created on a system. When a CREATE DATABASE statement is issued, the first part of the database is created by copying in the contents of the model database, then the remainder of the new database is filled with empty pages. Because tempdb is created every time SQL Server is started, the model database must always exist on a SQL Server system.
* msdb
The msdb database is used by SQL Server Agent for scheduling alerts and jobs, and recording operators.