Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Have valid view that returns data fine but View Design mode will not execute in SSMS - error ambiguous

$
0
0

This is a valid view that was created.  We can query the view and it works fine.  But if we select View  Design and try to execute it receives an error about ambiguous columns.  when using CAST. 

SQL with Open query to HANA. 

SQL Server 2008 R2 SP2.

SELECT     ACT_TIME, AEDAT, AENAM
FROM         OPENQUERY(HD1,
                      '
Select
"ACT_TIME",
cast("AEDAT" as date) as "AEDAT",
"AENAM"

FROM   "_SYS_BIC"."ztamko.ecc.td.mts.pp.exec/ZAN_PROC_ORDER_ITEMS"
WHERE "GLTRI" BETWEEN TO_DATS(ADD_DAYS(CURRENT_DATE, -31)) AND TO_DATS(ADD_DAYS(CURRENT_DATE, 0))
')SQL Execution Error.  Executed SQL statement:SELECT ACT_TIME,AEDAT.ToString() AS AEDAT, AENAM FROM OPENQUERY (HD1 , 'SELECT "ACT_TIME",'cast("AEDAT" as date) as "AEDAT", "AENAM" FROM "_SYS_BIC"."zt.ecc.td.mts.pp.exec/ZAN_PROC_ORDER_ITEMS" WHERE "GLTRI" BETWEEN TO_DATS(ADD_DAYS....... 

Error Source:  .Net SQLClient Data Provider

Error Message: Cannot fine either column "AEDAT" or the user-defined function or aggregate "AEDAT.ToString", or the name is ambiguous.

Any ideas?  known bug? 


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>