我得到了这个“Common Table Expression”Sql脚本,它运行得很完美,但在我的代码中使用server.createobject应用SQL脚本,我收到以下错误:
Microsoft VBScript运行时错误'800a000d' 类型不匹配:'[string:“WITH CTE AS(SELECT”]'
这是我的代码:
Set objFrConn = Server.CreateObject("ADODB.Command")
objFrConn.ActiveConnection = db
objFrConn.CommandText = "WITH CTE AS (SELECT...some code...) " & _
"SELECT * FROM CTE WHERE RN = 1 ORDER BY Date"
objFrConn.CommandType = 1
set rsListProduct=objFrConn.execute