Column name contain special character(/) !!!

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

Column name contain special character(/) !!!

Post by dsscholar »

Hi,

I have a SQL server database where my table contains columns name like
Byte_Received/sec ,Byte_sent/sec etc.... so while selecting these columns in query using ODBC Enterprise stage in datastage i have only selected either through select * from table or select \"Byte_Sent/sec" from table .... but due to this in column metadata i have written both of the option Byte_Sent/sec or Byte_Sent_sec but it fails the jobs and doesnt recognize the / character

Error Description:
main_program: Syntax error: Error in "export" operator: Error in operator arg: In field "Bytes_Total": Expected ";", got: "/", line 15
In field "Bytes_Received": Expected ";", got: "/", line 16
In field "Bytes_Sent": Expected ";", got: "/", line 17
In field "Packets": Expected ";", got: "/", line 18

Also possible things i have tried
1-Use ascii value of this character also
2-tried select * from table that not working
3-using escape charater also
4-use enable quoted identifier but that also not working.
5-I havent a plugin of SQL Server stage so that i will not tried yet.


If anyone facing similar kind of situation and get the solution plz share with us or have any possible solution throughwhich it get done plz share
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Have you tried "Bytes_sent\/sec"?
pandeeswaran
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

Post by dsscholar »

pandeesh wrote:Have you tried "Bytes_sent\/sec"?
Yes i hv tried this also but it doesnt return anything,just a blank data window is returned , not even column name is shown.
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Re: Column name contain special character(/) !!!

Post by SURA »

Hi Friend

select "Byte_Received/sec " as BYTERECVD_SEC from table name;

use BYTERECVD_SEC as a colum name in your metadata.

DS will not accept special char.

DS User
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

Re: Column name contain special character(/) !!!

Post by dsscholar »

Hi That we cant do if we do this then in datastage value inside the double quotes is considered as hardcode value for column so output like
BYTERECVD_SEC
Byte_Received/sec
Byte_Received/sec
Byte_Received/sec
Byte_Received/sec

so it will not return even in sql also provided anything in doubles quotes is considered as harccoded value...
so this will not work
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Re: Column name contain special character(/) !!!

Post by SURA »

Hi

I cant understand what you are tying to say.

If you have the colum like Byte_Received/sec , then in ODBC stage you need to give the column name as BYTERECVD_SEC and make it as user defined query and there you can give it like select "Byte_Received/sec " as BYTERECVD_SEC from table name;

I am sure it will work.

DS User
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

Re: Column name contain special character(/) !!!

Post by dsscholar »

No it not working...
because because datastage will not recognize the column in double quotes ...and double quotes value is considered as hardcoded value in DS plz try at ur end.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Assuming ANSI standard SQL, double-quotes indicates an identifier while single-quotes indicates a constant value. So check your settings (perhaps on the ODBC driver or database client connection) to ensure that ANSI standard SQL is being used. You might also try qualifying the column name with a table name or, as a last resort, defining synonyms on the table itself.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bicap
Premium Member
Premium Member
Posts: 95
Joined: Mon May 03, 2010 10:22 pm
Location: India
Contact:

Re: Column name contain special character(/) !!!

Post by bicap »

dsscholar wrote:No it not working...
because because datastage will not recognize the column in double quotes ...and double quotes value is considered as hardcoded value in DS plz try at ur end.
Try to use // for / in datastage.. Like/

Select bytereceived//sec...

Hope this helps..
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Re: Column name contain special character(/) !!!

Post by ray.wurlod »

bicap wrote:Hope this helps..
Hope?!

Did you verify it?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

Re: Column name contain special character(/) !!!

Post by dsscholar »

Hi Guys,

I have find out the solution and it is
we have to use column name in select query like this

select
[Bytes_Total/sec] as Bytes_Total_sec ,
Bandwidth_Utilization_Percentage,
[Bytes_Received/sec] as Bytes_Received_sec,
[Bytes_Sent/sec] as Bytes_Sent_sec from table;


It is working in Datastage so if anyone get scenrio like this in SQL SERVER is the source then use this braces [] in datastage.


Thanks guys

Regards
rahul
Post Reply