Tsql 在AdventureWorks2012中为每个BusinessEntityID设定具有值的支付历史记录表种子

Tsql 在AdventureWorks2012中为每个BusinessEntityID设定具有值的支付历史记录表种子,tsql,cursor,seeding,Tsql,Cursor,Seeding,我试图使用游标为一个带有值的表播种,我遇到了一个顽固的错误:(受影响的0行)Msg 8152,级别16,状态4,第43行字符串或二进制数据将被截断。调试器引用的行是: *设置@r=CAST(@p10为十进制)*@m*10.0*。到目前为止,我已经调试了许多错误,但仍坚持这一点。任何想法都很感激!:) 编辑:HumanResources.aPaymentHistory表的定义: GO --This table holds transactions between AB and it

我试图使用游标为一个带有值的表播种,我遇到了一个顽固的错误:(受影响的0行)Msg 8152,级别16,状态4,第43行字符串或二进制数据将被截断。调试器引用的行是: *设置@r=CAST(@p10为十进制)*@m*10.0*。到目前为止,我已经调试了许多错误,但仍坚持这一点。任何想法都很感激!:)

编辑:HumanResources.aPaymentHistory表的定义:

    GO
    --This table holds transactions between AB and it's employees.
    DROP TABLE AdventureWorks2012.HumanResources.aPaymentHistory;
    CREATE TABLE AdventureWorks2012.HumanResources.aPaymentHistory(
      Employee nchar NOT NULL,
      Amount money NOT NULL,
      Payday smalldatetime NOT NULL,
      Currency nvarchar(3) DEFAULT 'USD',
      Rate float DEFAULT '1',

      BusinessEntityID integer FOREIGN KEY REFERENCES       AdventureWorks2012.HumanResources.Employee (BusinessEntityID) NOT NULL,
 PaymentID nchar PRIMARY KEY NOT NULL
 );
 GO

我在第51行加了一句:“从c取下一个”。相同的错误。我已将问题隔离到INSERT语句中:INSERT INTO HumanResources.aPaymentHistory值('name',CAST(@r为money),@d,NULL,NULL,@p1,CONCAT('PAY:',CAST(@p1为nchar),':01');
    GO
    --This table holds transactions between AB and it's employees.
    DROP TABLE AdventureWorks2012.HumanResources.aPaymentHistory;
    CREATE TABLE AdventureWorks2012.HumanResources.aPaymentHistory(
      Employee nchar NOT NULL,
      Amount money NOT NULL,
      Payday smalldatetime NOT NULL,
      Currency nvarchar(3) DEFAULT 'USD',
      Rate float DEFAULT '1',

      BusinessEntityID integer FOREIGN KEY REFERENCES       AdventureWorks2012.HumanResources.Employee (BusinessEntityID) NOT NULL,
 PaymentID nchar PRIMARY KEY NOT NULL
 );
 GO