下面的代码可以显示当前用作输出的数据库
import numpy as np
m = np.array(['l','l','k','j','h','k'])
n = np.array([[1,2,3,4,5,6],[7,8,9,1,2,3]])
unique_elements, unique_indices = np.unique(m, return_index=True)
# you can return the unique elements as well as the corresponding indices
print(unique_elements, unique_indices)
# so you get what you want with:
print(m[unique_indices])
print(n[:,unique_indices])
但是当按如下方式使用DB_ID()函数时,会出现语法错误SELECT DB_ID(),DB_NAME()
Msg 102, Incorrect syntax near '('.
我尝试了DBCC PAGE(DB_ID(),1,1,3)
,但也不允许。
为什么?是否仅使用变量将当前数据库作为参数传递给DBCC PAGE的方式如下?
DBCC PAGE(select DB_ID() ,1,1,3)