How to find the line number of error in Teradata SQL Assistant - teradata

I'm new to Teradata SQL Assistant and have a simple issue that couldn't find the solution in Terada documentations.
How I can find the exact location of this error?

You need to parse the input and find strings that don't conform to your expectations.
For example...
SELECT
*
FROM
your_table
WHERE
TryCast(your_column AS INT) IS NULL
https://docs.teradata.com/r/Teradata-Database-SQL-Functions-Operators-Expressions-and-Predicates/March-2017/Data-Type-Conversions/TRYCAST/Syntax-Elements/data_type

Related

Can we create and use Temporary tables in DataStage?

Is it possible to create and/or use temporary tables in the ODBC connector stage of the DataStage?
I'm trying to update the data using a #Temp table in the join statement immediately after populating the Temp table.
I had looked according to the error form the job's log file but couldn't understand what it says,
Error message:
Unrecognized argument: variant='3.5\',
library=ccodbc,
version=1.0,
variantlist=\'V1;3.5::ccodbc\',
versionlist=\'1.0\',
name=ODBCConnector
}'
SAX parser exception thrown: The input ended before all started tags were ended. Last tag started was 'before' (CC_PropertySet::fatalError, file CC_PropertySet.cpp, line 2,266)
Got a solution!
Yes, we can use #Temp tables of SQL Server in DataStage ODBC stage, the query was absolutely perfect but the thing is DataStage couldn't prase the SQL Query. It considered it as DataStage parameter (since parameters in DataStage were bounded with #ParameterName#) So the DataStage compiler consider it as a incomplete parameter and thrown the error as above.
Solution: Use [ #Temp_Table ] to solve the issue.

Viewing A Teradata Alias

I wrote a query where I misspelled the alias I was using (this is pseudocode)
SELECT
ma.name
FROM mytable my
Teradata SQL Assistant did not give its usual error message saying ma does not exist, but ran for a long time and spooled out. I believe Teradata was processing all the rows in mytable.
When I changed the column selector to my.name the query ran as expected.
My question is, is it possible to see what Teradata SQL Assistant thinks the value of ma is?
Is there some setting which might define the default value of ma?
ma is not a column name in mytable

Export Multpile Tables Data as Insert Statements in to single file Oracle DB [duplicate]

The only thing I don't have an automated tool for when working with Oracle is a program that can create INSERT INTO scripts.
I don't desperately need it so I'm not going to spend money on it. I'm just wondering if there is anything out there that can be used to generate INSERT INTO scripts given an existing database without spending lots of money.
I've searched through Oracle with no luck in finding such a feature.
It exists in PL/SQL Developer, but errors for BLOB fields.
Oracle's free SQL Developer will do this:
http://www.oracle.com/technetwork/developer-tools/sql-developer/overview/index.html
You just find your table, right-click on it and choose Export Data->Insert
This will give you a file with your insert statements. You can also export the data in SQL Loader format as well.
You can do that in PL/SQL Developer v10.
1. Click on Table that you want to generate script for.
2. Click Export data.
3. Check if table is selected that you want to export data for.
4. Click on SQL inserts tab.
5. Add where clause if you don't need the whole table.
6. Select file where you will find your SQL script.
7. Click export.
Use a SQL function (I'm the author):
https://github.com/teopost/oracle-scripts/blob/master/fn_gen_inserts.sql
Usage:
select fn_gen_inserts('select * from tablename', 'p_new_owner_name', 'p_new_table_name')
from dual;
where:
p_sql – dynamic query which will be used to export metadata rows
p_new_owner_name – owner name which will be used for generated INSERT
p_new_table_name – table name which will be used for generated INSERT
p_sql in this sample is 'select * from tablename'
You can find original source code here:
http://dbaora.com/oracle-generate-rows-as-insert-statements-from-table-view-using-plsql/
Ashish Kumar's script generates individually usable insert statements instead of a SQL block, but supports fewer datatypes.
I have been searching for a solution for this and found it today. Here is how you can do it.
Open Oracle SQL Developer Query Builder
Run the query
Right click on result set and export
http://i.stack.imgur.com/lJp9P.png
You might execute something like this in the database:
select "insert into targettable(field1, field2, ...) values(" || field1 || ", " || field2 || ... || ");"
from targettable;
Something more sophisticated is here.
If you have an empty table the Export method won't work. As a workaround. I used the Table View of Oracle SQL Developer. and clicked on Columns. Sorted by Nullable so NO was on top. And then selected these non nullable values using shift + select for the range.
This allowed me to do one base insert. So that Export could prepare a proper all columns insert.
If you have to load a lot of data into tables on a regular basis, check out SQL Loader or external tables. Should be much faster than individual Inserts.
You can also use MyGeneration (free tool) to write your own sql generated scripts. There is a "insert into" script for SQL Server included in MyGeneration, which can be easily changed to run under Oracle.

InvalidCastException for LINQPAD

I'm using LinqPad and IQ driver for SQLite. I have connection with this file. Look:
"Okreslone rzutowanie jest nieprawidlowe" - it can be simple translate to "invalid cast", but Zbiors.Count() return value 8.
When i'm trying do it in SQL query:
select * from zbior
Then all's ok. How can i get same result by "C#", not by SQL query?
Most likely, the types are incorrect. SQLite has a horrible "feature" whereby you can put strings into integer columns and vice versa. The column types are merely suggestion and are not enforced. So what looks like integers in your data might actually be strings, causing in InvalidCastException when the IQ driver tries to read them.

Invalid object name 'product_Design'

I am getting this error while saving my data into the table. I have already created a 'product_Design' table in my database. I am using Sql Server 2008. Everything is working fine on local host but not on the server. I also tried to insert data in different tables and its working but I am just not able to insert data in this(product_Design) table ? I really need help regarding this thing.
here is my sql query
insert into z3ctjholo.dbo.product_Design values(#prodID, #productName, #designName, #designPath, #finalDesign, #front, #cont, #divHeight, GETDATE(), 0, 1)
I also tried this query
insert into product_Design values(#prodID, #productName, #designName, #designPath, #finalDesign, #front, #cont, #divHeight, GETDATE(), 0, 1)
Both the queries are generating error. Please help me out.
Thanks..
So finally i found what is the problem. if you ever face such kind of problem then execute this command in sql server and see whether your table is connected to any schema apart from dbo. Use this statement to check whether the table is connected to any other schema.
use yourDatabaseName
Then
SELECT * FROM INFORMATION_SCHEMA.TABLES
after that if you find that your table is connected with other schema apart from dbo then use your any statement like this
select * from schemaName.tableName
(eg. my schema name is z3ctjholo and my table name is product_Design)
so my statement would be like this
select * from z3ctjholo.product_Design
what i was doing wrong, i was using two schema names (z3ctjholo.dbo.product_Design).
I hope it will help someone..
Thanks...
There are two reasons, I can find so far.
1. Either the connection settings in web.config is incorrect.
2. your database is case sensitive collation and so check the name with case. May be you have created the table with name Product_Design and trying to insert in product_Design, in this case also, the command may not work.
Please check both the points.

Resources