Exception from HRESULT: 0xC0207016 Error at Data Flow Task [OLE DB Source [1]]: There is a data source column with no name. Each data source column must have a name.

JESUS EDUARDO CHAVARIN ROCHA 81 Reputation points
2022-08-25T19:54:11.303+00:00

Hello, when previewing the data table to send to excel, I get the error, this is my code:

DECLARE @YA AS DATETIME = GETDATE()
SELECT DATEPART(ISO_WEEK, @YA)

SELECT * FROM Datos.dbo.RegistroDeEntradas
WHERE DATEPART(ISO_WEEK, @YA) = NoSem
ORDER BY Fecha ASC

I'm trying to select just the data with the same number as the number of the week.

Photo: view view

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,834 questions
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 112.8K Reputation points
    2022-08-25T20:27:15.323+00:00

    Try removing this line:

     *SELECT DATEPART(ISO_WEEK, *@YA)

    However, if you really need it, then add a name:

     *SELECT DATEPART(ISO_WEEK, *@YA) as IsoWeek

    0 comments No comments

0 additional answers

Sort by: Most helpful