Evaluate in T-SQL

后端 未结 11 2195
悲&欢浪女
悲&欢浪女 2020-12-17 23:42

I\'ve got a stored procedure that allows an IN parameter specify what database to use. I then use a pre-decided table in that database for a query. The problem I\'m having i

11条回答
  •  攒了一身酷
    2020-12-18 00:06

    There's no "neater" way to do this. You'll save time if you accept it and look at something else.

    EDIT: Aha! Regarding the OP's comment that "We have to load data into a new database each month or else it gets too large.". Surprising in retrospect that no one remarked on the faint smell of this problem.

    SQL Server offers native mechanisms for dealing with tables that get "too large" (in particular, partitioning), which will allow you to address the table as a single entity, while dividing the table into separate files in the background, thus eliminating your current problem altogether.

    To put it another way, this is a problem for your DB administrator, not the DB consumer. If that happens to be you as well, I suggest you look into partitioning this table.

提交回复
热议问题