[步骤]
[结果]
[期望]
开始时间:19:25:53错误代码: N1925534
错误信息: 15_137_2_-2146232060
SQL类型: SELECT
错误类型: incorrect_syntax
SQL语句: [19:25:53] -------------------------------------------------------------
CODE:N1925534
Error:15_137_2_-2146232060
SQL:SELECT * into #temp_WithBattery from
(
select 1 as id,'普货'as name union ALL
select 2 as id,'纯电池'as name union ALL
select 3 as id,'带内置电池'as name union ALL
select 4 as id,'带外置电池'as name union ALL
select 5 as id,'含纽扣电池'as name union ALL
select 6 as id,'液体'as name union ALL
select 7 as id,'粉末'as name union ALL
select 8 as id,'打火机'as name union ALL
select 9 as id,'刀具_剪刀_仿真枪'as name union ALL
select 10 as id,'带磁物品'as name union ALL
select 12 as id,'木质类_竹质类'as name union ALL
select 11 as id,'其他禁运物品'as name union ALL
select 13 as id,'膏状'as name union ALL
select 14 as id,'易碎'as name union ALL
select 15 as id,'动物羽毛类'as name union ALL
select 16 as id,'大功率电池'as name union ALL
select 17 as id,'电子烟'as name union ALL
select 18 as id,'移动电源'as name union ALL
select 19 as id,'可拆卸电池'as name union ALL
select 20 as id,'厨具'as name union ALL
select 21 as id,'电机_马达'as name union ALL
select 22 as id,'超体积普'as name union ALL
select 23 as id,'超体积非普'as name union ALL
select 24 as id,'手机'as name union ALL
select 25 as id,'平衡车'as name union ALL
select 26 as id,'液体笔类'as name union ALL
select 27 as id,'纺织品'as name union ALL
select 28 as id,'植物种子'as name union ALL
select 29 as id,'深圳普货'as name union ALL
select 30 as id,'成人用品'as name union ALL
select 31 as id,'无'as name union ALL
select 32 as id,'眼镜'as name union ALL
select 33 as id,'口红'as name union ALL
select 34 as id,'手表'as name union ALL
select 35 as id,'香水'as name union ALL
select 36 as id,'纯液体'as name union ALL
select 37 as id,'医疗设备'as name union ALL
select 38 as id,'人造羽毛'as name union ALL
select 39 as id,'内置锂金属电池'as name union ALL
select 40 as id,'配套干电池'as name union ALL
select 41 as id,'厨房刀具'as name union ALL
select 42 as id,'军工刀具'as name union ALL
select 45 as id,'无线充'as name union ALL
select 46 as id,'原木'as name union ALL
select 47 as id,'面具类'as name union ALL
select 48 as id,'金属高密度'as name union ALL
select 49 as id,'防疫用品'as name union ALL
select 50 as id,'酒精'as name union ALL
select 51 as id,'酒精棉'as name union ALL
select 52 as id,'纸巾'as name union ALL
select 0 as id,'未选择'as name union ALL
select 103 as id,'面罩类'as name union ALL
select 207 as id,'反倾销属性'as name union ALL
select 234 as id,'哑铃(10KG+)'as name union ALL
select 236 as id,'蜡烛类'as name union ALL
select 268 as id,'食品接触类'as name union ALL
select 382 as id,'食品接触类(易碎)'as name union ALL
select 383 as id,'食品接触类(木质)'as name union ALL
select 384 as id,'食品接触类(带电)'as name union ALL
select 385 as id,'配套电池'as name union ALL
select 386 as id,'内置电池(查验)'as name union ALL
select 387 as id,'内置电池(人体接触)'as name union ALL
select 388 as id,'外置电池(查验)'as name union ALL
select 389 as id,'纽扣电池(查验)'as name union ALL
select 390 as id,'弱磁'as name union ALL
select 391 as id,'弱磁(查验)'as name union ALL
select 392 as id,'强磁'as name union ALL
select 393 as id,'普通刀具_剪刀'as name union ALL
select 394 as id,'户外刀具'as name union ALL
select 395 as id,'仿真枪'as name union ALL
select 396 as id,'医疗用品'as name union ALL
select 397 as id,'酒精类'as name union ALL
select 398 as id,'玩具'as name union ALL
select 399 as id,'玩具(查验)'as name union ALL
select 400 as id,'植物类'as name union ALL
select 401 as id,'种子类'as name union ALL
select 402 as id,'按摩类'as name union ALL
select 403 as id,'普货(人体接触)'as name union ALL
select 404 as id,'查验'as name union ALL
select 406 as id,'一次性塑料用品'as name
)t
SELECT * INTO #temp_NoSalePlatform
FROM (
select 1 as NoSalePlatform,1 as 平台id,'Amazon' as 平台名 union all
select 2 as NoSalePlatform,23 as 平台id,'Wish' as 平台名 union all
select 3 as NoSalePlatform,2 as 平台id,'Ebay' as 平台名 union all
select 4 as NoSalePlatform,57 as 平台id,'AliExpress' as 平台名 union all
select 5 as NoSalePlatform,35 as 平台id,'Cdiscount' as 平台名 union all
select 7 as NoSalePlatform,58 as 平台id,'Lazada' as 平台名 union all
select 8 as NoSalePlatform,42 as 平台id,'Shopee' as 平台名 union all
select 9 as NoSalePlatform,47 as 平台id,'Jumia' as 平台名 union all
select 10 as NoSalePlatform,45 as 平台id,'Walmart' as 平台名 union all
select 11 as NoSalePlatform,51 as 平台id,'Joom' as 平台名 union all
select 12 as NoSalePlatform,62 as 平台id,'Vova' as 平台名 union all
select 13 as NoSalePlatform,52 as 平台id,'MyMall' as 平台名 union all
select 14 as NoSalePlatform,63 as 平台id,'JdId' as 平台名 union all
select 15 as NoSalePlatform,67 as 平台id,'Allegro' as 平台名 union all
select 16 as NoSalePlatform,39 as 平台id,'Tophatter' as 平台名
)t
SELECT * INTO #temp_sku FROM (
select a.sku,a.ProductGroupSKU 母体sku,b.CheckTime as '终审时间',
a.ProductNameCN 产品中文名,
a.MinSaleNum 起批量,a.SearchKeyword 搜索关键词,pb.BrandName 品牌,
case a.ProductState when 0 then '正常' when 1 then '起批量' when 2 then '停产' when 3 then '锁定' when 4 then '暂时缺货' when 5 then '清库' end as '产品状态',
a.lastbuyprice 采购价,c.ClassNameCn 一级类目,d.ClassNameCn 二级类目,e.ClassNameCn 三级类目,
case when a.ProductProperty=2 then '仿牌' else '否' end as '仿牌侵权',
f.name as '物流属性',a.GrossWeight as '产品毛重',a.PackWeight as '产品包装重',a.Length 长,a.Width 宽,a.Height 高,b.NoSalePlatform as '平台禁售',wp.库存
from RB_Product a
left join RB_Product_Admin b
on a.sku=b.sku and a.CustomerID=b.CustomerID
left join RB_Product_Class c
on c.id=a.ClassID1 and c.CustomerID=a.CustomerID
left join RB_Product_Class d
on d.id=a.ClassID2 and d.CustomerID=a.CustomerID
left join RB_Product_Class e
on e.id=a.ClassID and e.CustomerID=a.CustomerID
left join #temp_WithBattery f
on f.id=a.WithBattery
left join (select sku,sum(goodnum) 库存,customerid from rb_warehouse_product (nolock) wp WHERE wp.CustomerID=1 AND wp.WareHouseID IN (2,333,3922,5312) GROUP BY sku,customerid)wp
on wp.sku=a.sku and wp.customerid=a.customerid
LEFT JOIN dbo.RB_Product_Brand (nolock) pb
ON pb.CustomerID=a.CustomerID AND pb.id=a.BrandID
where
a.CustomerID=@customerid AND
b.CheckStatus=1 )t
SELECT * INTO #temp_sold FROM (
SELECT a.sku,COUNT(DISTINCT a.ordercode) 订单数,sum(a.ProdutNumUpdate+a.ProductNum) 销量
FROM dbo.RB_Report_OrderSettlement (nolock) a
WHERE a.CustomerID=1 AND a.ShipTime>=@startdate
AND a.ShipTime<@enddate AND a.SalesRefunds=0 AND a.WareHouseID in (select id from RB_WareHouse where customerid=1 and warehousetype in (1,3) )
GROUP BY a.sku)t
SELECT a.*,b.* FROM #temp_sold a
LEFT JOIN #temp_sku b
ON a.sku=b.sku
WHERE a.销量>=1
ORDER BY a.订单数
PARAMS:@CustomerId = 1 ,
MESSAGE:Must declare the scalar variable "@startdate".
Incorrect syntax near the keyword 'GROUP'.
TRACE: 在 System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
在 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
在 System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
在 System.Data.SqlClient.SqlDataReader.get_MetaData()
在 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
在 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
在 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
在 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
在 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
在 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
在 RB.DAL.DBOperator.ExecuteReader(String SQLString, SqlParameter[] cmdParms, Boolean IsWriteDB, Int32 Timeout) 在 RB.DAL.DBOperator.toCommonTipException(SqlException ex, String sql, SqlParameter[] cmdParms)
在 RB.DAL.DBOperator.ExecuteReader(String SQLString, SqlParameter[] cmdParms, Boolean IsWriteDB, Int32 Timeout)
在 Biz.Irobotbox.ReportCentre.CustomReportService.GetPageDataForCustomReportToSqlDataReader(String firstFileFullPath, RB_CustomReportTask customReportTask, String[] noPermsissionfields, Dictionary`2 paramList, List`1 exportFields, String orderBy, Int32 timeOut)
在 Biz.Irobotbox.ReportCentre.CustomReportService.ExportCSVBySteam(RB_CustomReportTask customReportTask, String[] noPermsissionfields, Dictionary`2 paramValues, List`1 exportFields, String orderField, Int32 timeOut)
在 Biz.Irobotbox.ReportCentre.CustomReportService.ExecuteCustomReportTask(List`1 customReportList)
在 System.Threading.Tasks.Task.Execute()
在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
在 System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
在 System.Threading.Tasks.Schedulers.LimitedConcurrencyLevelTaskScheduler.<NotifyThreadPoolOfPendingWork>b__6_0(Object _)
在 System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
在 System.Threading.ThreadPoolWorkQueue.Dispatch()
-------------------------------------------------------------

这个是战略那边的自定义报表