Topic
  • 2 replies
  • Latest Post - ‏2013-03-06T06:31:15Z by SystemAdmin
SystemAdmin
SystemAdmin
301 Posts

Pinned topic Is CAST() work in optim?

‏2013-03-04T11:18:50Z |
Hi,
I am Salamat,in my project am using optim tool.i found this issue with optim in CAST().

i tried CAST() function in optim but its not working,is CAST() working in optim if yes please give me syntax for that.Following is the query which have i used.

select SUM (ROUND (CAST( real1 AS VARCHAR(255) ),3)) as 'HashSum' from sql_num_hash_all:dbo.test_hash1
Note:Here 'real1' in above query is the column name
O/P:
com.attunity.connect.common.infrastructure.workspace.WorkspaceException:com.attunity.connect.common.infrasturcture.transport.TransportException:clien.requestError(query.prepareSql):
42000 Syntax error or access violation
AO47 Syntax error at line 1 position 32 near 'AS'(one of follows was expected:',',')') in SQL 'select SUM(
ROUND(CAST (real1 AS VARCHAR(255))),3)) as 'HashSum' from sql_num_hash_all:dbo.test_hash1'

[3]
I think optim took VARCHAR(255) as alias

Please help me as this is urgent and i stuck here from past one week.I know its working fine with convert(), but according to my requirement i want to use only CAST().

Thanks in advance
Salamat
Updated on 2013-03-06T06:31:15Z at 2013-03-06T06:31:15Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    301 Posts

    Re: Is CAST() work in optim?

    ‏2013-03-05T22:13:53Z  
    Hello:

    Hope things are well. Can you try the cast statement without the additional predicates to test (i.e. remove the SUM, ROUND and just use a SELECT).
    Is there anyway that you can provide a test row of data in an Archive file that I can use here? Create an Optim Connect datasource and test
    with?

    Best regards,
    Kevin
  • SystemAdmin
    SystemAdmin
    301 Posts

    Re: Is CAST() work in optim?

    ‏2013-03-06T06:31:15Z  
    Hello:

    Hope things are well. Can you try the cast statement without the additional predicates to test (i.e. remove the SUM, ROUND and just use a SELECT).
    Is there anyway that you can provide a test row of data in an Archive file that I can use here? Create an Optim Connect datasource and test
    with?

    Best regards,
    Kevin
    Hi Kevin,
    Thanks for reply,i tried cast statement without the additional predicates to test by removing sum,round and only tried with select statement but still got same error.Below is test column data separated by comma

    http://46.00, 51.00, 69.00, 148.00, 487.00, 1940.00, 8173.00, 34916.00, 149641.00, 641812.00, 8.00, 8.00, 8.00, 8.00, 8.00, 8.00, 8.00, 8.00, 8.00, 8.00
    These are the values of single column of REAL datatype.
    Please help me in resolving this.

    Thanks
    Salamat