sql来删除title字段内容长度大于30字符的数据

weizewang 2009-06-30 01:11:24
sql来删除title字段内容长度大于30字符的数据命令怎样写啊?
...全文
824 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
SQLite 数据库取数据长度确实是用length啊
不对?
liangjianyong 2009-07-24
  • 打赏
  • 举报
回复
注意这里是在字段中插入数据,不是插入10M的记录,而是在一条记录中的某一个字段插入10M大小的数据

use Jeditest

go


if object_id('temp','U') is not null
begin
drop table temp
end



create table temp(
ch1 nvarchar(max),ch2 nvarchar(max),
ch3 nvarchar(max),ch4 nvarchar(max)

)



declare @temp nvarchar(max)
declare @count bigint
set @count =1
set @temp = ''
while @count<=4096
begin
set @temp= @temp + '0012345678901234567890123401234567890123456789012340123456789012345678901234012345678901234567890123401234567890123456789012340123456789012345678901234012345678901234567890123401234567890123456789012340123456789012345678901234012345678901234567890123412345'
set @count=@count+1
end
select @count;
insert into temp values(@temp,@temp,@temp,@temp)
wangjinkun 2009-07-09
  • 打赏
  • 举报
回复

<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from table "
rs.open sql,conn,1,3
do while not rs.eof
if len(rs("title"))>30 then
rs.delete
rs.update
end if
rs.movenext
loop
rs.close
set rs=nothing
%>
weizewang 2009-07-08
  • 打赏
  • 举报
回复
还是不对
Coding_Playing_Boy 2009-07-08
  • 打赏
  • 举报
回复
sqllit,你搞wince开发还是?
qizhicong2 2009-07-08
  • 打赏
  • 举报
回复
delete from [table] where len(title)>30
sd5816690 2009-07-08
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 weizewang 的回复:]
还是不对
[/Quote]
那就找取长度的函数是哪个,取出长度作判断就行了
sd5816690 2009-06-30
  • 打赏
  • 举报
回复
delete from [table] where length(title)>30

第一次看到 SQLite 数据库,google 了一下,取长度的函数应该如上

len 是 sql server 的写法
weizewang 2009-06-30
  • 打赏
  • 举报
回复
报错了SQLite error no such function:len
sd5816690 2009-06-30
  • 打赏
  • 举报
回复
delete from [table] where len(title)>30

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧