我想制作php函数,我将发送数据库名称(我使用的是MSSQL 2008):
function get_query($database)
(
$query = ";WITH [cteRows] AS
(
SELECT [nazwa],
[wartosc],
[czas],
ROW_NUMBER() OVER (ORDER BY [czas]) AS [RowNumber]
FROM ('$database')
WHERE [nazwa] = 'coldbox7/WymianaDanychDB/Hydraulic'
AND [czas] >= '2016-07-14 22:00:00.000'
AND [czas] <= '2016-07-14 22:30:00.000'
)";
return $query;
)
$database1 = '[test].[dbo].[coldbox7]';
$query1 = get_query($database1);
我有错误,您能告诉我应该如何向查询发送数据库名称吗?