将行值设置为sql中的变量

时间:2018-11-07 11:46:26

标签: sql-server tsql variables syntax

如果我的销售订单为68,并且salesorderprexies不是'SO-'或'QU-',则尝试将salesorders.pickinglocation设置为448。我收到了一个sytax错误。

DECLARE @SalesOrder bigint = 68       --[Identifier]  
DECLARE @PickingLocation bigint  = 448

set SalesOrders.PickingLocation = @PickingLocation

FROM SalesOrderItems
inner join salesorders on salesorderitems.salesorder = SalesOrders.SalesOrder
inner join SalesOrderPrefixes on salesorders.salesorderprefix = SalesOrderPrefixes.salesorderprefix

WHERE SalesOrders.Salesorder = @SalesOrder
AND SalesOrderPrefixes.SalesOrderPrefixId <>'SO-' AND SalesOrderPrefixes.SalesOrderPrefixId <> 'QU-'

0 个答案:

没有答案