Adding transformations in Sybase replication server - hana

We have primary source database as Oracle 11gR2 and target as SAP HANA. We are trying to test SAP - Sybase Replication server for replication from Primary ORACLE to Target HANA.
We need to add extra columns such as RECORD_DATE and LAST_MODIFIED_DATE to HANA tables. Is it possible to add Transformations or extra columns to target tables which are not present in Primary Database.
Best Regards

are you thinking of adding these fields during replication.
or want to merge them after replication. If after replication you want to merge them simply just go to Hana Studio and make an Information view to get the the merged or simply joined data from different tables.
and if that table is not present in the the source System then instead of replication make a Excel flat file and import it into Hana using the Import option on the RHS of hana studio.
and The only way to Alter a table definition in Hana is by Using the Alter Table SQL statement no other Shortcuts. Or just import and make a join.

I'm assuming you want to capture auditing data for records inserted/updated by the Repserver maintenance user (in the HANA database).
While the column default (for inserts; as discussed with Shivam) will work, for updates you've got a few options:
an update trigger on the HANA table [I don't work with HANA so I don't know if this is doable]
defining the update column as a (materialized) computed column, with the associated function being responsible for obtaining the current date/time when other columns in the table are modified [while this is doable in Sybase ASE, I don't know if this is doable in HANA]
(in repserver) create a custom function string for the rs_update function on this table which emulates a standard rs_update function string with the addition of an update of LAST_MODIFIED_DATE = getdate() (replace getdate() with HANA's equivalent of the current date/time) [there are a couple different ways to do this depending on SRS version, what's doable with HANA-specific function strings, and personal preference - a bit much to go into at this point if a custom function string is going to be out of the question or you've already got an acceptable solution]

Related

How can I get the modified table name(any table in db) and it's modified value without using triggers in SQL Server?

I am creating database snapshot for reporting(creating a common demoralized table from normalized tables), for which I need to enter normalized tables modified values at the same time when the table modify. I want a common solution for this. Same is achievable using triggers but I am looking for some other generic solution which will work with any table change. Is there any other way in SQL server by which I can achieve the same?

What is the correct SQL syntax for this SQL statement

I am using a Content Management system (DotNetNuke) that has a MS SQL backend. The logfiles for the CMS system (not SQL Server) have become enormous so I wish to delete them.
I'm trying to execute a Truncate statement, but apparently the LogFile table is joined to three other tables.
A fellow in the community wrote a SQL script that takes all of this into consideration. The instrtuction call for:
Install by running as script from SQL item in Host menu inside DNN or
run in
SQL Server Management Studio, after replacing placeholders {databaseOwner} and {objectQualifier} by its proper values from
web.config file.
In the case of objectQualifier I checked web.config and it is:
objectQualifier=""
So my question in the following statement do I replace everything in the brackets AND delete the brackets as well with ""
Here is one of the many lines where I must replace this information:
IF EXISTS (SELECT * FROM sys.sysobjects WHERE id = object_id(N'{databaseOwner}[{objectQualifier}sys_currentDNNVersion]') AND Type = N'FN')
DROP FUNCTION {databaseOwner}[{objectQualifier}sys_currentDNNVersion]
GO
I must do the same for {databaseOwner}
I assume that you are referring to the EventLog. In recent versions of DNN it has been organized into 3 tables, not the single table of prior versions.
Look here: http://www.dnnsoftware.com/community-blog/cid/155180/howto-truncate-your-eventlog-in-dnn-740
You can also configure the Event Log so that you don't save everything.
If you are referring to other tables, what are they?
To add to the answer of Joe Craig. Before DNN 7.4 you could do this
TRUNCATE TABLE sitelog;
TRUNCATE TABLE schedulehistory;
TRUNCATE TABLE eventlog;
However they added 2 more columns to the EventLog with Foreign Keys so you cannot truncate it anymore.
Download a script here (not mine). It will remove the constraints, truncate the tables and re-add the constraints again.

SQL Server: Create a duplicate of a database without the data

I have a database called AQOA_Core with huge amount of data.
I have a newly created database called AQOA_Core1 which is basically empty. I want to write a query to duplicate AQOA_Core to AQOA_Core1 without the data. I guess to be precise I want to create a skeleton of the primary database into the secondary database.
PS: I use Toad for my database operations.
You can use SQL Server Script Wizard for scripting database objects. You can exclude data, and select the database object types you want to include in your script
Please check the SQL Server guide I referenced above,
I hope it helps you

Modify the dataset format in SAS on a `sql-base` server

Usually I would use proc datasets lib= ; modify to change the format/informats of the columns in a datasets. But when I apply this syntax to a dataset on a sql-based server.
The error shows
ERROR: The HEADER/VARIABLE UPDATE function is not supported by the ODBC engine.
I found some articles that may explain the problem. Here's one. http://support.sas.com/kb/37/015.html
Moreover, whatever dataset I created in the network, the format/informat/length is changed to its 'default' setting. E.g date9. -> datetime 22.3.
But still I don't understand why it happens. Is there something pre-defined in the network and the architecture of the server is not 100% compatible with SAS?
When you modify format, You alter table.
Suppose you have some diferent database (SQL) servers. Example Oracle, MS SQL, MY SQL. All of them have their own dialect on altering table.
When You write modify column; ... you are altering table. But SAS does not which dialect to try. That is why alter table procedure is not supported from datasets procedure.
You can update that table using database server dialect, but it needs to be added from proc sql procedure. Like it was writen in that article
execute( alter table table-name ...specific-Oracle-syntax...)by oracle;
data9. I think You mean date9.. Well it is SAS format. Other database servers, can have or can have not this format. By default they will create database default formats.

Alter table schema based on another table

In sql if i had 2 databases where each had similar columns but not exactly the same schema , is there a built in way to alter the schema of a table in database2 make it similar to the schema in of a table database1?
considering that the column type and column name and default value are the factors to decide if 2 columns match.
No, there is no built in functionality for doing this, you will either have to do it manually or use a comparison tool such as RedGate SQL Compare or Visual Studio.