Using Teradata Volatile Table in SSIS ADO NET Source - volatile

Put simply, can I use an ADO NET Source task to query a Teradata VOLATILE TABLE? For context, using Teradata SQL Assistant, I can easily create a Teradata VOLATILE TABLE, insert data into it and select data from it. In Visual Studio, using SSIS SQL Tasks, I am also able to create and insert date into a Teradata VOLATILE TABLE. However, because the table does not actually exist yet, it appears we cannot use a separate ADO NET Source task to select data from it, meaning we also cannot map the columns. We get the error "[Teradata Database][3807] Object 'TABLE_NAME' does not exist." If the data in a VOLATILE TABLE, and more accurately the VOLATILE TABLE column definitions, are only available at run time can an ADO NET Source task be used to query a Teradata VOLATILE TABLE? If so, how?

Really old, and not sure if it will work. But You can set validation to false, that might do what you are wanting.

Related

Partition a table in teradata using SAS DI studio 4.902

For ETL operations we use SAS DI studio and then finally the tables are loaded in Teradata. DDL is dynamically generated in SAS DI Studio for the tables created. But when we want to customize the DDL to include partitions it throws an error. Can anyone suggest a workaround?
Note: We cannot create the DDL in Teradata first and then register the table in SAS DI Studio to be using it.
In the table properties->Options->advanced and write custom SQL in create table option it works fine for UNIQUE PRIMARY INDEX(NOTI_DT)
But when we try
UNIQUE PRIMARY INDEX(NOTI_DT)
PARTITION BY RANGE_N(NOTI__DT BETWEEN DATE'1950-01-01'AND DATE'2022-12-31' EACH INTERVAL '1' MONTH)
it throws an error:
The "invalid option name" error appears to be due to having quotes within the option string. Try doubling the quotes:
UNIQUE PRIMARY INDEX(NOTI_ASSIGN_DT)
PARTITION BY RANGE_N(NOTI_ASSIGN_DT BETWEEN DATE''1950-01-01'' AND DATE''2022-12-31'' EACH INTERVAL ''1'' MONTH)

BTEQ "Create set table" equivalent in Snowflake sql

I want to know the equivalent query of Teradata BTEQ "create set table" in Snowflake SQL. I'm working on query conversion between BTEQ to Snowflake. Is there any direct syntax? If not, how can I create a set(Allows only unique values/records) table?
Snowflake doesn't have this functionality, and I don't know any database other than Teradata that does.
You can try to emulate that e.g. by always inserting data using a temporary staging table and then MERGE or INSERT..SELECT.., explicitly avoiding duplicates (on the loading side), or access the data through a view that does SELECT DISTINCT * FROM table.

Biztalk Insert or Update in to database using the SQL bindings

I have a requirement where the data from one database has to be selected and inserted or updated in to the other database depending on the destination. I have used the DBBinding to select from the source.In the destination do I have to use stored procedure to do this or selecting Insert and Update in the DBBinding will work for this.
You can use Insert or Update unless you have some complex requirement to do in stored procedure.
You should probably use a stored procedure for this and perform an upsert within it. You could use a Composite Operation to send all the data across to SQL in one transaction or investigate using a Table Value Parameter so you can send multiple rows to the stored proc (depending on the number of rows!).
To do this you would need to create a MAP between your source data and the Composite Schema.
This way you are only concerened with the schema of the stored procedure and the Composite Schema.
See:
https://msdn.microsoft.com/en-us/library/dd788136.aspx
HTH

How to use variables in sqlite

Created the following code in SQL however need to use it in sqlite (phonegap specifically).
INSERT INTO actions(Action) VALUES ('Go to the pub');
SET #aid = LAST_INSERT_ID();
INSERT INTO statements(statement, Language) VALUES ('Have a pint', 'English');
SET #sid = LAST_INSERT_ID();
INSERT INTO Relationships(SID,AID) VALUES (#sid,#aid);
The issue we are having however is how to declare the variables in sqlite.
The LAST_INSERT_ID() will become last_insert_rowid(), however what is the sqlite version of SET #aid = ?
SQLite does not have variables.
In an embedded database such as SQLite, there is no separate server machine or even process, so it would not make sense to add a programming language to the DB engine when the same control flow and processing logic could be just as well done in the application itself.
Just use three separate INSERT statements.
(In WebSQL, the result object has the insertId property.)

SQLite "Drop table" error message: "SQL logic error or missing database"

I am running a SQLite database in memory and I am attempting to drop a table with the following command.
DROP TABLE 'testing' ;
But when I execute the SQL statement, I get this error
SQL logic error or missing database
Before I run the "Drop Table" query I check to make sure that the table exists in the database with this query. So I am pretty sure that the table exists and I have a connection to the database.
SELECT count(*) FROM sqlite_master WHERE type='table' and name='testing';
This database is loaded in to memory from a file database and after I attempt to drop this table the database is saved from memory to the file system. I can then use a third party SQLite utility to view the SQLite file and check to see if the "testing" exists, it does. Using the same 3rd party SQLite utility I am able to run the "Drop TABLE" SQL statement with out error.
I am able to create/update tables without any problems.
My questions:
Is there a difference between a memory database and a file database in SQLite when dropping a table?
Is there a way to disable the ability to drop a table in SQLite that I may have accentually turned on somehow?
Edit: It appears to have something to do with a locked table. Still investigating.
You should not have quotes in your DROP TABLE command. Use this instead:
DROP TABLE testing
I had the same problem when using Sqlite with the xerial jbdc driver in the version 3.7.2. and JRE7
I first listed all the tables with the select command as follows:
SELECT name FROM sqlite_master WHERE type='table'
And then tried to delete a table like this:
DROP TABLE IF EXISTS TableName
I was working on a database stored on the file system and so it seems not to effect the outcome.
I used the IF EXISTS command to avoid listing all the table from the master table first, but I needed the complete table list anyway.
For me the solution was simply to change the order of the SELECT and DROP.

Resources