随笔分类 -  SqlServer

摘要:View Code --查询所有数据库use masterselect * from sysdatabases where dbid>4;--系统自带的数据库分别是master->1,model->3,msdb->4,tempdb->2--查询数据库中所有数据库(存储过程)exec sp_helpdb;--查询指定数据库中的表use masterselect * from sysobjects where xtype='u' ;if object_id('#test1') is not nulldrop table #test1go 阅读全文
posted @ 2012-05-02 16:59 楠木大叔 阅读(296) 评论(0) 推荐(0) 编辑
摘要:sql server有两个转义符: ' 默认情况下, '是字符串的边界符, 如果在字符串中包含', 则必须使用两个', 第1个'就是转义符 <![cdata[ 另一个转义符是" 当SET QUOTED_IDENTIFIER OFF时, "是字符串边界符, 字符串中的"必须用两个"表示。 vb: "" <=> "sql server 2000: ''' <=> 'eg:declare @SearchType nvarchar( 阅读全文
posted @ 2012-04-27 17:06 楠木大叔 阅读(898) 评论(0) 推荐(0) 编辑
摘要:面试常见的Sql语句和大家分享:问题1:Sql查询重复问题解答:---查询重复数据example:表名:Cpf_file字段名:cpf01select * from Cpf_file where cpf01 in (select cpf01 from Cpf_file group by cpf01 having count(1) >= 2)问题2:Sql去除重复问题解答:example:原表:TestEisUser临时表:TempTB--第一步 将不重复的数据记录筛选出来存储到新的临时表中select distinct * into TempTB from TestEisUser --第 阅读全文
posted @ 2012-04-17 16:07 楠木大叔 阅读(557) 评论(0) 推荐(1) 编辑

点击右上角即可分享
微信分享提示