使用 text、ntext 和 image 函数
有两个 text、ntext 和 image 函数专门用于对 text、ntext 和 image 数据所进行的操作: TEXTPTR 返回 binary(16) 对象,该对象包含指向 text、ntext 或 image 实例的指针。指针一直有效,直到删除该行。
TEXTVALID 函数用来检查指定的文本指针是否有效。 
文本指针被传递到用于操作 text、ntext 和 image 数据的 READTEXT、UPDATETEXT、WRITETEXT、PATINDEX、DATALENGTH 和 SET TEXTSIZE Transact-SQL 语句。在 Transact-SQL 语句中,总是使用数据的指针或地址来引用 text、ntext 和 image 数据。下面的示例使用 TEXTPTR 函数来查找与 pubs 数据库的 pub_info 表中 pub_id 0736 相关联的 text 列 (pr_info)。下例首先声明一个局部变量 @val。然后将文本指针(长二进制字符串)置于 @val 中,并将其作为参数提供给 READTEXT 语句,该语句将返回从第五个字节(偏移量为 4)开始的 10 个字节。USE pubs
DECLARE @val varbinary(16)
SELECT @val = textptr(pr_info) FROM pub_info
WHERE pub_id = '0736'
READTEXT pub_info.pr_info @val 4 4下面是结果集:(1 row(s) affected)pr_info
----------------------------------------
 yet支持使用 CAST 函数进行从 text 到 varchar、从 ntext 到 nvarchar 和从 image 到 varbinary 或 binary 的显式转换,但 text 或 image 数据将截断为 8,000 个字节,ntext 数据将截断为 4,000 个字符(8,000 个字节)。从 text、ntext 或 image 到其它数据类型的转换(无论是显式的还是隐性的)都不支持。但是,可以对 text、ntext 或 image 数据进行间接转换,例如: CAST( CAST( text_column_name AS VARCHAR(10) ) AS INT )。

解决方案 »

  1.   

    你应创建一个ID号,通过ID号删除,不可能通用IMAGE来查询重复记录!
      

  2.   

    使用 UPDATETEXT 在适当的位置更改 text、ntext 或 image 列的一部分。删除现有数据:指定一个非空 insert_offset 值、非零 delete_length 值。不指定要插入的新数据。
      

  3.   

    alter table 表 add  newfield int identity(1,1)delete 表
    where newfield not in(
     select min(newfield) from 表 group by 除newfield外的所有字段
                         )alter table 表 drop column newfield
      

  4.   

    alter table 表 add  newfield int identity(1,1)delete 表
    where newfield not in(
     select min(newfield) from 表 group by 除newfield外的所有字段和image列
                         )alter table 表 drop column newfield
      

  5.   

    蚂蚁的:去除重复值
    如果有ID字段,就是具有唯一性的字段delect table where id not in (  select max(id) from table group by col1,col2,col3...
    )
    group by 子句后跟的字段就是你用来判断重复的条件,如只有col1,那么只要col1字段内容相同即表示记录相同。
    2,如果是判断所有字段也可以这样
      select * into #aa from table group by id1,id2,....
      delete table 
      insert into table 
      select * from #aa
    3,没有ID的情况select identity(int,1,1) as id,* into #temp from tabel
    delect # where id not in (
      select max(id) from # group by col1,col2,col3...)
    delect table
    inset into table(...)
       select ..... from #temp
    col1+','+col2+','...col5 联合主键
    select * from  table where col1+','+col2+','...col5 in (  select max(col1+','+col2+','...col5) from table 
    where having count(*)>1
    group by col1,col2,col3,col4 
    )
    group by 子句后跟的字段就是你用来判断重复的条件,如只有col1,那么只要col1字段内容相同即表示记录相同。2,
    select identity(int,1,1) as id,* into #temp from tabel
    select * from  #temp where id in (
      select max(id) from #emp where having count(*)>1 group by col1,col2,col3...)
      

  6.   

    晕了..还是不懂啊..我现在要删除info表中的重复记录..里有个content的属性是text的.帮帮偶啊..写个语句出来..谢谢!!!!!