I found strange rules in MS SQL CREATE VIEW syntax. It must be on the first line of query batch processing and it must be created in the current database.
I should make VIEWs that have dynamic name described by string variables (type: VARCHAR or NVARCHAR). And those VIEWs should be created in other databases.
Because of the rule, CREATE VIEW statement must be on the first line of query batch processing, it cannot be after USE statement. So, I tried to change databases with USE & GO statement. But GO statement seemed to make clear all the variables. Therefore they are not available that describe VIEW name after GO statement.
Do you have any opinon for me? And if you know the reasons of CREATE VIEW syntax rules, please tell me.
Oh~, Sorry. I missed one thing. The names of databases are also dynamic. And VIEWs, I want to make, not only should access tables of other databases but also shoule be created in other databases.
Though I don't know OLAP well, I think this situation is involved OLAP.