我不明白为什么会出现这样的错误(在下面的代码中标明)。
我试图将其置于评论中,但错误仍然发生在第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'