Error for byte size

  • Hi,

    I am getting the following error for following query I am trying to run. Anyone can advise what is the issue here? Can't find the reason behind this issue. Thanks in advance!

    QUERY:

    SELECT death.continent, death.location, death.date, population, vaccine.new_vaccinations,

    SUM(CONVERT(INT,vaccine.new_vaccinations)) OVER (partition by death.location ORDER BY death.location,death.date) RollingPeopleVaccinated

    FROM [Portfolio project]..['covid_deaths'] death

    JOIN [Portfolio project].. ['covid_vaccinations'] vaccine

    ON death.location = vaccine.location

    AND death.date = vaccine.date

    WHERE death.continent is not NULL

    ORDER BY 2,3

     

    ERROR:

    ORDER BY list of RANGE window frame has total size of 1020 bytes. Largest size supported is 900 bytes.

     

  • that death.location column is bigger than 1k bytes I would assume by the error.

     

    but do give has the ddl for the 2 tables involved.

  • death.column size in the table or name itself is the problem here?

  • size of the column

    e.g. varchar(xxxx)

    so do give the ddl as asked.

  • Got it! Thanks!

  • Yes. It worked when I changed the column size. This is what worked for me:

     

    ALTER TABLE 'table name'  ALTER COLUMN 'column name'  nvarchar(150)

  • Hi,

    What exactly was your final code? I am struggling with this same issue while trying to follow a YouTube tutorial by Alex the Analyst.

     

    Many thanks.

  • In case anyone is looking at this in the future -

    converting the date as date worked for me too, but it did take a while to run the query.

    If anyone can say what the best approach is that would be great.

    Select cd.continent, cd.location, cd.date, cd.population, cv.new_vaccinations, 
    SUM(CONVERT(bigint, cv.new_vaccinations)) OVER
    (Partition by cd.location Order by cd.location, CONVERT(date, cd.date))
    From PortfolioProject..CovidDeaths cd
    Join PortfolioProject..CovidVaccinations cv
    On cd.location = cv.location
    and cd.date = cv.date
    Where cd.continent is not null
    Order by 2, 3

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply