Is it possible to declare a variable within a View? For example:
Declare @SomeVar varchar(8) = \'something\'
gives me the syntax error:
How often do you need to refresh the view? I have a similar case where the new data comes once a month; then I have to load it, and during the loading processes I have to create new tables. At that moment I alter my view to consider the changes. I used as base the information in this other question:
Create View Dynamically & synonyms
In there, it is proposed to do it 2 ways: