MSSQL消息213,级别16,状态1,过程tr_insertmerch,第29行

时间:2019-06-25 18:21:28

标签: sql sql-server database sql-server-2012

我不熟悉SQL Server。我已经习惯了MySQL,并且有点想查询。不确定是什么问题。

我得到的错误是:

  

第213条消息,状态16,状态1,过程tr_insertmerch,第29行   列名或提供的值数与表定义不匹配。

列名或提供的值数通常意味着查询具有比列多的值,或者反之亦然,但我数了数,它们都适合。我也检查了两次名字,它们看起来也不错。我想知道问题是否来自tr_insertmerch

但是我不知道那在哪里。在几天前我向表中添加了新列之前,查询工作正常。我添加了一个名为youtubevideo的列,该列在此查询中设置为NULL。

INSERT INTO
   merchant( register_date, name, phone, fax, email, anonymous, bank_name, account, routing, payment_modeID, website, description, free_call, street_address, zip, city, reference_name, reference_phone, tax1_num, tax2_num, login, password, regionID, statusID, cardID, monthly_fees, money_royalty_on_receive, money_royalty_on_send, sellerID, subsellerID, distributor, pourcentage, BtoC, trans_commission_rate_promo, trans_commission_rate, guaranted_card, youtubevideo) 
VALUES
   (
      '06-25-2019', 'somewebsite', '514 795-4444', NULL, 'info@somewebsite.com', '1', 'Bank', NULL, NULL, NULL, 'http://www.somewebsite.com', 'compagny', NULL, '41 Rue De l ile', 'G9B 7L4', 'Trois-Rivières', NULL, NULL, NULL, NULL, 'info@somewebsite.com', '*******', '12', '1', '363460', '0.00', '2', '0', '201', '196112', '0', '30', '1', '25', '30', NULL, NULL
   )

这是我的商人表的出口

USE [CLICLoyalty]
GO
/****** Object:  Table [dbo].[merchant]    Script Date: 25/06/2019 2:16:26 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[merchant](
    [merchantID] [bigint] NOT NULL,
    [register_date] [smalldatetime] NOT NULL,
    [name] [varchar](50) NOT NULL,
    [phone] [varchar](20) NOT NULL,
    [fax] [varchar](20) NULL,
    [email] [varchar](255) NULL,
    [anonymous] [bit] NOT NULL,
    [e_com] [bit] NOT NULL,
    [bank_name] [varchar](100) NULL,
    [account] [varchar](50) NULL,
    [routing] [varchar](50) NULL,
    [payment_modeID] [smallint] NULL,
    [alias_url] [varchar](100) NULL,
    [website] [varchar](100) NULL,
    [description] [text] NULL,
    [free_call] [varchar](50) NULL,
    [street_address] [varchar](100) NOT NULL,
    [zip] [varchar](20) NOT NULL,
    [city] [varchar](50) NOT NULL,
    [last_update] [smalldatetime] NOT NULL,
    [balance] [money] NOT NULL,
    [creditLine] [money] NOT NULL,
    [clic_balance] [money] NOT NULL,
    [monthly_fees] [money] NOT NULL,
    [clic_monthly_fees] [money] NULL,
    [min_clic_buy] [money] NOT NULL,
    [max_clic_buy] [money] NOT NULL,
    [min_clic_sell] [money] NOT NULL,
    [max_clic_sell] [money] NOT NULL,
    [min_money_buy] [money] NOT NULL,
    [max_money_buy] [money] NOT NULL,
    [min_money_sell] [money] NOT NULL,
    [max_money_sell] [money] NOT NULL,
    [reference_name] [varchar](50) NULL,
    [reference_phone] [varchar](20) NULL,
    [tax1_num] [varchar](50) NULL,
    [tax2_num] [varchar](50) NULL,
    [login] [varchar](255) NULL,
    [password] [varchar](30) NULL,
    [regionID] [bigint] NOT NULL,
    [sellerID] [bigint] NULL,
    [statusID] [int] NULL,
    [clic_royalty_on_receive] [int] NOT NULL,
    [money_royalty_on_receive] [int] NOT NULL,
    [clic_royalty_on_send] [int] NOT NULL,
    [money_royalty_on_send] [int] NOT NULL,
    [cardID] [bigint] NOT NULL,
    [subsellerID] [int] NULL,
    [email_new_merchant] [tinyint] NULL,
    [sent_as_new_merchant] [datetime] NULL,
    [languageID] [tinyint] NULL,
    [distributor] [bit] NOT NULL,
    [pourcentage] [int] NOT NULL,
    [BtoC] [bit] NOT NULL,
    [trans_commission_rate_promo] [int] NULL,
    [trans_commission_rate] [int] NULL,
    [promo] [bit] NULL,
    [publication_date] [datetime] NULL,
    [guaranted_card] [int] NULL,
    [youtubevideo] [varchar](max) NULL,
 CONSTRAINT [PK_Merchant] PRIMARY KEY CLUSTERED 
(
    [merchantID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [unique_log_merch] UNIQUE NONCLUSTERED 
(
    [login] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [UQ_UniqueMerchantID] UNIQUE NONCLUSTERED 
(
    [merchantID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_register_date]  DEFAULT (getdate()) FOR [register_date]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_anonymous]  DEFAULT ((0)) FOR [anonymous]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_e_com]  DEFAULT ((1)) FOR [e_com]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_balance_date]  DEFAULT (getdate()) FOR [last_update]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_balance]  DEFAULT ((0)) FOR [balance]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_credit_line]  DEFAULT ((0)) FOR [creditLine]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_clic_balance]  DEFAULT ((0)) FOR [clic_balance]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_monthly_fees_1]  DEFAULT ((0)) FOR [monthly_fees]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_min_cash_buy]  DEFAULT ((0)) FOR [min_clic_buy]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_max_cash_buy]  DEFAULT ((0)) FOR [max_clic_buy]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_min_sell]  DEFAULT ((0)) FOR [min_clic_sell]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_max_sell]  DEFAULT ((0)) FOR [max_clic_sell]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_min_buy]  DEFAULT ((0)) FOR [min_money_buy]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_max_buy]  DEFAULT ((0)) FOR [max_money_buy]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_min_cash_sell]  DEFAULT ((0)) FOR [min_money_sell]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_max_cash_sell]  DEFAULT ((0)) FOR [max_money_sell]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_trans_clic_rate]  DEFAULT ((0)) FOR [clic_royalty_on_receive]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_trans_money_rate]  DEFAULT ((0)) FOR [money_royalty_on_receive]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_trans_sell_money_rate]  DEFAULT ((0)) FOR [clic_royalty_on_send]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_Merchant_trans_sell_clic_rate]  DEFAULT ((6)) FOR [money_royalty_on_send]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_merchant_email_new_merchant]  DEFAULT ((1)) FOR [email_new_merchant]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_merchant_sent_as_new_merchant]  DEFAULT (NULL) FOR [sent_as_new_merchant]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_merchant_languageID]  DEFAULT ((2)) FOR [languageID]
GO
ALTER TABLE [dbo].[merchant] ADD  DEFAULT ((0)) FOR [distributor]
GO
ALTER TABLE [dbo].[merchant] ADD  DEFAULT ((50)) FOR [pourcentage]
GO
ALTER TABLE [dbo].[merchant] ADD  DEFAULT ((1)) FOR [BtoC]
GO
ALTER TABLE [dbo].[merchant] ADD  DEFAULT ((25)) FOR [trans_commission_rate_promo]
GO
ALTER TABLE [dbo].[merchant] ADD  DEFAULT ((40)) FOR [trans_commission_rate]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_merchant_promo]  DEFAULT ((0)) FOR [promo]
GO
ALTER TABLE [dbo].[merchant] ADD  CONSTRAINT [DF_merchant_publication_date]  DEFAULT (NULL) FOR [publication_date]
GO
ALTER TABLE [dbo].[merchant] ADD  DEFAULT ((0)) FOR [guaranted_card]
GO
ALTER TABLE [dbo].[merchant]  WITH CHECK ADD  CONSTRAINT [FK_Merchant_card] FOREIGN KEY([cardID])
REFERENCES [dbo].[card] ([cardID])
GO
ALTER TABLE [dbo].[merchant] CHECK CONSTRAINT [FK_Merchant_card]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'default current date' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'merchant', @level2type=N'COLUMN',@level2name=N'register_date'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0:no 1:yes default : 0' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'merchant', @level2type=N'COLUMN',@level2name=N'anonymous'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0: if merchant cannot sell on the website 1:yes default:1' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'merchant', @level2type=N'COLUMN',@level2name=N'e_com'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'default current date' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'merchant', @level2type=N'COLUMN',@level2name=N'last_update'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'default : 0' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'merchant', @level2type=N'COLUMN',@level2name=N'balance'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'default:0' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'merchant', @level2type=N'COLUMN',@level2name=N'creditLine'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'clic rate that merchant should give to the head_office' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'merchant', @level2type=N'COLUMN',@level2name=N'clic_royalty_on_receive'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'royalty rate that merchant should give to the head_office' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'merchant', @level2type=N'COLUMN',@level2name=N'money_royalty_on_receive'
GO

1 个答案:

答案 0 :(得分:2)

我希望""是触发器的名称,它可以应用于商家表。

您还需要更正触发器内的新列。

unary plus operator在SSMS中找到与所述表格相关的触发器列表。