Skip to content
Advertisement

Why does my SQL query not have any columns?

I’m not an expert by any means but I write SQL queries fairly regularly.

I am pulling data via Crystal Reports 2013 from SQL Server 2016 (not positive about the version). Just as an aside, CR permits parameters so that’s what {?DateStart} is. {?DateStart} and {?DateEnd} are regular dates, {?ServiceProvider} is a number array. The EXEC sw_vwDateRange generates a table that has a row for every date in between {?DateStart} and {?DateEnd}.

I had this query that worked: (Edited 2021-01-19 14:28 EST to simplify/improve query)

I was getting some inefficiencies because I was pulling data from a non-indexed view, vw_Stays, so I replaced it with references to the original tables.

But it stopped working entirely. It doesn’t give me any errors, it just completes the query with no columns and no data.

Sorry if this has already been answered but I really don’t know what search terminology to use!

Advertisement

Answer

Wow, so, this is embarrassing, but turns out I spelled the name of one of the tables wrong. (wrong number of s’s in HIFIS_StaysRoomsBedsHistory.) I’ll just go crawl away and hide now. But I learned a lot in troubleshooting this! Thanks for the info about CROSS APPLY, I will put that to good use.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement