1、今天写存储过程是运行时总是提示如下错误:

Subquery returned more than 1 value. This is not permitted when the subquery follows =, t!=, <, <= ,>, >= or when he subquery is used as an expression.

后来我一点点的查找终于知道是哪里的问题了,下面是错误的语句:

    select * from ResultTable where charIndex(','+convert(varchar(40),CenterID)+',',','+(SELECT OrgUnitIds FROM VolunteerSearch_Filter WHERE (UserId = 1) AND (SearchType = 'report') )+',')>0

 SELECT OrgUnitIds FROM VolunteerSearch_Filter WHERE (UserId = 1) AND (SearchType = 'report') 

所获得的记录不是唯一的因此错了。

2、存储过程运行提示错误:

String or binary data would be truncated.

Warning: Null value is eliminated by an aggregate or other SET operation.

The statement has been terminated。

解决方案:这是因为某字段的长度不够造成的。增大字段的长度就可以了。

相关文章:

  • 2021-11-07
  • 2022-03-01
  • 2021-06-18
  • 2022-12-23
  • 2021-04-17
  • 2022-01-04
  • 2021-05-26
  • 2021-09-04
猜你喜欢
  • 2022-12-23
  • 2021-10-01
  • 2022-02-12
  • 2022-12-23
  • 2021-11-19
  • 2021-11-30
  • 2022-12-23
相关资源
相似解决方案