参数数据类型文本对于len的参数无效

时间:2015-01-20 12:46:04

标签: sql sql-server-2005

我不明白为什么会出现这样的错误(在下面的代码中标明)。

我试图将其置于评论中,但错误仍然发生在第64行。 我使用的是sql server 2005.

错误:

Msg 8116, Level 16, State 1, Procedure prSwiftGetMessages, Line 64
Argument data type text is invalid for argument 1 of len function.

代码:

delete from Messages where LOAD_DATE >= @minDate print 'Deleted : ' + convert(varchar, @@ROWCOUNT)

print 'Date MIN = ' + convert(varchar, @minDate,102)

print 'Dropping Indexes.' 
if exists (select 'x' from sysindexes where name = 'idxMessagesReference')
      drop index Messages.idxMessagesReference 
if exists (select 'x' from sysindexes where name = 'idxMessagesLoadDate')
      drop index Messages.idxMessagesLoadDate 
if exists (select 'x' from sysindexes where name = 'idxMessagesBankTo')
      drop index Messages.idxMessagesBankTo 
if exists (select 'x' from sysindexes where name = 'idxMessagesBankFrom')
      drop index Messages.idxMessagesBankFrom 
if exists (select 'x' from sysindexes where name = 'idxMessagesTo')
      drop index Messages.idxMessagesTo -- ERROR HERE !! 
if exists (select 'x' from sysindexes where name = 'idxMessagesFrom')
      drop index Messages.idxMessagesFrom 
if exists (select 'x' from sysindexes where name = 'idxMessagesEnv')
      drop index Messages.idxMessagesEnv print 'Indexes Dropped'

0 个答案:

没有答案