我一直在做一个小项目,可以这么说,其中包括大量的代码改造。我对旧的 sql 连接符号有基本的了解,其中大部分是我从 stackoverflow 中获得的,但是我注意到周围的很多结构与我所熟悉的非常不同。就将其转换为现代 SQL 代码而言,我基本上对设置类似于此的代码感到困惑。我想让这与其他人相关,但我认为大多数软件会在几年前更新。任何建议将不胜感激。
If @SelectLevel = '' Or @SelectLevel = 'B'
Select @SQLCmd =
'SELECT Stop_Number, ''B'' AS Inv_Type, Inv_Desc, ' +
'Box_Number AS Item_Number, BOX.Company_ID, BOX.Department_ID, BOX.Group_Id, BOX.Section_Id, ' +
'BOX.Media_Code, BOX.Location_Current, BOX.Location_Home, BOX.Hold_Status, BOX.Record_Type, ' +
'BOX.Alternate_Id, BOX.Description1, BOX.Retention_Code, BOX.Retention_type, BOX.Retention_Disposal, ' +
'BOX.Description2, BOX.Description3, ' +
'Reservation_Status, BOX.Disposition_Status ' +
'FROM BOX, DISPOSITION_MEMO, (SELECT Item_Type, Item_Number, MAX(Reservation_Process_Status) AS ' +
'Reservation_Status FROM RESERVATION GROUP BY Item_Type, Item_Number) AS RESV, ' +
'(SELECT Ele_Text AS Inv_Desc, Ele_Usr_Text AS Inv_Usr_Type, Ele_Action ' +
'FROM ELEMENT_METRICS WHERE Ele_Name = ''Inventory'' AND Ele_Type = ''Dropdown'') AS INVTYPE ' +
'WHERE Stop_Number = ' + Convert(Char(10),@Disposition_Number) + ' AND ' +
'INVTYPE.Ele_Action = ''B'' AND ' +
'Box_Number *= RESV.Item_Number AND RESV.Item_Type = ''B'' AND ' +
'BOX.Stop_Number = DISPOSITION_MEMO.Disposition_Number AND ' +
'BOX.Stop_Date = DISPOSITION_MEMO.Issue_Date'