SQL Error

Dear Community,

I have a question about reading data from  mssql DB.

 

I have a query like this:

 

select distinct A.c3, B.c4, C.c6
from A
join B on B.c2 = A.c1
join C on C.c5 = A.c1
where 
..

 

Table C also has a column named as "c3".

 

It ran and read data. Cubes were loaded but when I checked SQL log file I saw some strange logs.

 

The column 'c3' was specified multiple times for 't'.

 

I found a solution like "not to read data with *". But as you can see here, I gave the table name.

What I understood from the error log is, Board converts the query and read data with "Select *...".

 

Do you have an idea about how to solve this problem?

 

Thank you for your help.

Answers

  • Are you accessing Board data through MS SQL DB?

  • Hi Selvet Yönsel,

    Generally speaking, having twice the same column in the select part of a statement is not problematic, if you are using different aliases.

    Now you'll need to find out, which data reader is causing the problem. Then look at the SQL statement that is created by Board, or which manual statement you created.

    Maybe the problem is that some view you are using has the problem itself.

    BR, Ray

  • Bas Koomen
    Bas Koomen Active Partner
    Second Anniversary First Comment

    An option is to create this query as a view in SQL and then retrieve the result in Board with a reader.

  • Dear Jason Park,

     

    I am accessing MS SQL DB through Board. I have a data reader that connects to DB and read data into the Board cube.

     

    Regards,

    Selvet

  • Dear Ray Martens,

    Thank you for your reply. I checked sql log file and saw that Board converts SQL into this format:

    " Select * from .....". What ever you wrote in selection part is not important.

    I need to find out how can I prevent this.

    Kind regards,

    Selvet

  • Dear Bas Koomen,

     

    This SQL DB is not under my control but I will ask db admin if it is possible to create this view. Thank you for the idea

     

    Kind regards,

    Selvet

  • Do you have a manual query? If so, the error could be there. If not, do you need the distinct part?

  • Dear Ray Martens,

    Yes I have a manual query but this query runs on DB without any errors.

  • Ok, so you'll just have to ensure that all your columns of the manual query have different names - even though it works without changes in your SSMS environment. Do this with aliases if necessary.