gpt4 book ai didi

SQL Server 2008 列名称 'Type' 未显示在更新查询中

转载 作者:行者123 更新时间:2023-12-02 05:40:35 25 4
gpt4 key购买 nike

我有一个名为 Bowzer 的表,其中有一列名为 Type

当我尝试运行此查询时,SSMS 无法识别列 Type

这是我的问题

update Bowzer
set inserted_by = ISNULL(inserted_by, 'Auto')
where (bowzer_id = 8 and inserted_by is null and type='CRUDE')

这里不识别Type列,报错

Invalid Column Name Type

是否不允许使用此列名 Type

此外,我想检查 Inserted_By 列是否为空,然后将其替换为值 Auto

我该怎么做?

编辑 - 1 个 DDL 到 Table Bowzer

CREATE TABLE [dbo].[Bowzer](
[bowzer_id] [numeric](18, 0) IDENTITY(1,1) NOT NULL,
[bowzer_no] [nvarchar](20) NULL,
[quantity] [numeric](18, 0) NULL,
[dip1] [numeric](18, 0) NULL,
[Cmpt_Capacity1] [numeric](5, 0) NULL,
[dip2] [numeric](18, 0) NULL,
[Cmpt_Capacity2] [numeric](5, 0) NULL,
[dip3] [numeric](18, 0) NULL,
[Cmpt_Capacity3] [numeric](5, 0) NULL,
[dip4] [numeric](18, 0) NULL,
[Cmpt_Capacity4] [numeric](5, 0) NULL,
[dip5] [numeric](18, 0) NULL,
[Cmpt_Capacity5] [numeric](5, 0) NULL,
[expiry_date] [datetime] NOT NULL,
[status] [bit] NOT NULL,
[inserted_on] [datetime] NULL,
[inserted_by] [nvarchar](20) NULL,
[Type] [nvarchar](50) NULL,
CONSTRAINT [PK_Bowzer] PRIMARY KEY CLUSTERED
(
[bowzer_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

最佳答案

试试这个

update Bowzer
set inserted_by = ISNULL(inserted_by, 'Auto')
where (bowzer_id = 8 and inserted_by is null and [type]='CRUDE')

关于SQL Server 2008 列名称 'Type' 未显示在更新查询中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11026938/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com