sql
来源:互联网 发布:淘宝修改差评 编辑:程序博客网 时间:2024/06/03 16:33
--创建链接服务器
exec sp_addlinkedserver 'ITSV ', ' ', 'SQLOLEDB ', '远程服务器名或ip地址 '
exec sp_addlinkedsrvlogin 'ITSV ', 'false ',null, '用户名 ', '密码 '
--查询示例
select * from ITSV.数据库名.dbo.表名
--导入示例
select * into表 from ITSV.数据库名.dbo.表名
--以后不再使用时删除链接服务器
exec sp_dropserver 'ITSV ', 'droplogins '
select substring((select name from goods where id=1),0,3)--截取字符串
select DATALENGTH((select name from goods where id=2))--查看字符串包含几个字符
select RIGHT((select name from goods where id=2),2)--截取从右边数的两个字符
EXEC master..xp_fixeddrives--查看硬盘分区
--比较两表是否相等
if (select checksum_agg(binary_checksum(*)) from goods)
=
(select checksum_agg(binary_checksum(*)) from sell)
print '相等'
else
print '不相等'
获取当前数据库中的所有用户表
select Name from sysobjects where xtype='u' and status>=0
select name fromsyscolumns where id in (select id fromsysobjects where type = 'u' and name = '表名')
一张表有一万多条记录,表的第一个字段 RecID 是自增长字段, 写一个SQL语句, 找出表的第31到第40个记录。
select top 10 recid from A where recid not in(select top 30 recid from A)
- SQL
- SQL
- SQL
- sql
- sql
- SQL
- sql
- SQL (-)
- sql
- SQL
- SQL
- SQL
- sql
- sql
- sql
- sql
- SQL
- sql
- CorePlot使用的配置步骤
- PK在线翻译一个我们经常用的词汇“剪切”
- Microsoft APIs and frameworks
- 反论文抄袭检查,吼吼,终于找到了
- 小米语音社区“米吧”上手体验评测
- sql
- 2011-09-24百度笔试题(技术研发)
- 安装VS2008关于解决磁盘已满问题方案.
- 【SQL】练习并熟练掌握用T-SQL查询命令进行数据查询的技能【原创技术】
- C# 中Datatime类用法总结
- C#读写Word文档异常处理解析System.Runtime.InteropServices.COMException
- 枚举类型的初始化工具
- Oracle的差异增量备份和累积增量备份
- android 截屏的命令