随笔分类 -  sql

sql 2000
MSSQL 2005删除所有表的语句[转]
摘要:godeclare @tbname varchar(250)declare #tb cursor for select name from sysobjects where objectproperty(id,'IsUserTable')=1open #tbfetch next from #tb into @tbnamewhile @@fetch_status=0begin exec('drop ... 阅读全文
posted @ 2010-01-27 11:23 cean 阅读(530) 评论(0) 推荐(0)
表中随机查询记录
摘要:从表topic中随机查询topictype为1和2的记录各10条,select * from(select * from(select top 10 topicid,topic,topictype,content,answer,author,addtime,itemid from cean_topic where topictype=1 order by newid()) as a1 union ... 阅读全文
posted @ 2009-12-13 18:01 cean 阅读(460) 评论(0) 推荐(0)
[转]SQL2000和SQL2005同时安装问题
摘要:1,因为SQL2000安装过程中无法修改实例名称,故安装过程中必须先安装SQL2000,然后在安装SQL2005.安装SQL2005时必须修改SQL实例名称,否则将和SQL2000的实例名称冲突.2,安装完SQL2005后,开始准备用SQL2000客户端工具连接SQL2005,结果报告不能用SQL2000客户端工具连接,只能用SQL2005客户端工具连接,后证明SQL2005客户端工具可以同时连接... 阅读全文
posted @ 2009-05-29 09:23 cean 阅读(357) 评论(0) 推荐(0)
sql用replace查找替换内容
摘要:replace使用规则: repalce(要置换的字段,需要替代的字符,替换后的字符) 如将bankmember表 intro字段的 ' 单引号,替换为&#39 update bankmember set intro=replace(cast(intro as varchar(8000)),'''','&#39') ========== 记得是用'单引号哦,如果有更多的语句,希望大家能帮我指... 阅读全文
posted @ 2008-12-27 10:57 cean 阅读(9477) 评论(0) 推荐(0)