在这里我想用表格的列显示变量值
declare @BaseMetal varchar(40)
set @BaseMetal='18K'
SELECT CAST(@BaseMetal as varchar(40)) 'BaseMetal', tbl.Columm1,tbl.Columm2, tbl.Columm3 from tbl
O/P 应该是:
BaseMetal Columm1 Columm2 Columm3
18K colval1 colval1 colval1
18K colval2 colval2 colval2
但是当我尝试它显示错误Must declare the scalar variable "@BaseMetal".