sql - 从 SQL 中提取时跳过 excel 中的列
问题描述
因此,当我在两者之间运行 select 语句时,我想跳过 excel 中的一列:
strSql = strSql & " COLCUDF.Revision#1Date," 和 strSql = strSql & " COLCUDF.FinalActDate,"
因为该列中有一个公式。
Dim rstProjRls As New ADODB.Recordset
Dim cmdProjRls As New ADODB.Command
Set cnnSSVERP = New ADODB.Connection
cnnSSVERP.Open "Driver={SQL Server};Server=" & Range("dbServer") & ";Database=" & Range("dbName") & ";Uid=" & Range("dbUser") & ";Pwd=" & Range("dbPassword") & ";"
cnnSSVERP.CursorLocation = adUseClient
If cnnSSVERP.State Then
Else
GoTo No_Connection
End If
strSql = ""
strSql = strSql & "Select "
strSql = strSql & " Coalesce(Year(PRI.ShipSchedDate), Year(PRI.PMReq),0) As ReportYearGroup, "
strSql = strSql & " Coalesce(Month(PRI.ShipSchedDate), Month(PRI.PMReq),0) As ReportMonthGroup, "
strSql = strSql & " CO.ID As SalesOrder, "
strSql = strSql & " COLCUDF.ReleaseNo, "
strSql = strSql & " PRI.ProjectName, "
strSql = strSql & " LTrim(COL.MISC_REFERENCE) As Description, "
strSql = strSql & " COCUDF.ProjectType, "
strSql = strSql & " PRI.Plant, "
strSql = strSql & " PRI.ReleaseStatus, "
strSql = strSql & " COLCUDF.EngineerLead, "
strSql = strSql & " COLCUDF.Engineer, "
strSql = strSql & " COCUDF.Estimator, "
strSql = strSql & " PRI.ProjectManager, "
strSql = strSql & " COLCUDF.PostCheck, "
strSql = strSql & " COLCUDF.ProjTODate, "
strSql = strSql & " COLCUDF.CalcNumber, "
strSql = strSql & " COLCUDF.StampDueDate, "
strSql = strSql & " COLCUDF.StampActDate, "
strSql = strSql & " COLCUDF.SubDueDate, "
strSql = strSql & " COLCUDF.SubOutDate, "
strSql = strSql & " COLCUDF.RevisionNumber, "
strSql = strSql & " COLCUDF.InRevision#1Date, "
strSql = strSql & " COLCUDF.Revision#1DueDate, "
strSql = strSql & " COLCUDF.Revision#1Date, "
strSql = strSql & " COLCUDF.FinalActDate, "
strSql = strSql & " PRI.Installation, "
strSql = strSql & " COLCUDF.TCODate, "
strSql = strSql & " COLCUDF.Notes "
解决方案
这将插入一个空列:
strSql = strSql & " COLCUDF.Revision#1Date, "
and strSql = strSql & "'', "
and strSql = strSql & " COLCUDF.FinalActDate, "
我希望这有帮助!最大限度
推荐阅读
- vb.net - VB.NET 和 IME KeyUp 事件
- javascript - 如何在谷歌堆积条形图上显示多个工具提示
- c - 如果输入特定值,如何退出 scanf 函数?
- caching - chrome 浏览器仅在使用 etag 和 last-modified-date 时才显示 200(来自磁盘缓存)
- javascript - 使物体以一定速度从 A 点移动到 B 点的算法
- python - 切片单词但不能使输出正确
- java - Java 设置占位符或变量方法
- python - 从数据框中的列中获取纬度和经度
- unit-testing - 测试 QWidget 接收鼠标输入
- assembly - 反复调用后,Scanf 似乎无法正常工作(英特尔 x86_64 nasm 程序集)