我正在尝试将表中的列从十进制转换为int或bigint。
ALTER PROCEDURE [dbo].[spr_ODW_GetStocksForGlobalPart]
@globalPartId bigint
AS
BEGIN
SELECT
dbo.tbl_ODW_SvPartSapLocation.stockBlocked,
dbo.tbl_ODW_SvPartSapLocation.stockUnrestricted,
dbo.tbl_ODW_SvPartSapLocation.stockValuated,
dbo.tbl_ODW_SvPartSapLocation.stockValuatedCurrency,
tbl_ODW_SapLocation.name as sapLocationName
FROM
dbo.tbl_ODW_GlobalPart
INNER JOIN
dbo.tbl_ODW_SvPartSapLocation ON dbo.tbl_ODW_GlobalPart.id = dbo.tbl_ODW_SvPartSapLocation.globalPartId
INNER JOIN
tbl_ODW_SapLocation ON dbo.tbl_ODW_SvPartSapLocation.sapLocationId = tbl_ODW_SapLocation.id
WHERE
(dbo.tbl_ODW_GlobalPart.id = @globalPartId)
UPDATE [dbo].[spr_ODW_GetStocksForGlobalPart]
ALTER COLUMN dbo.tbl_ODW_SvPartSapLocation.stockValuated int/bigint
有人可以帮助我吗?
答案 0 :(得分:0)
您需要使用ALTER TABLE
来修改表格的结构:
ALTER TABLE [dbo].[tbl_ODW_SvPartSapLocation]
ALTER COLUMN stockValuated INT
UPDATE
用于更新表中的数据行 - 而不是表结构。
如果您只想在从表格中选择时更改存储过程中的数据类型,请使用CAST
:
SELECT
dbo.tbl_ODW_SvPartSapLocation.stockBlocked,
dbo.tbl_ODW_SvPartSapLocation.stockUnrestricted,
CAST(dbo.tbl_ODW_SvPartSapLocation.stockValuated AS INT),
.......