<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>中国web开发网-sql server</title><description><![CDATA[sqlserver]]></description><link>http://www.ntsky.com</link><language>UTF-8</language><copyright>www.ntsky.com</copyright><managingEditor>yntsky@gmail.com</managingEditor><webMaster>yntsky@gmail.com</webMaster><pubDate>2008-10-16 02:00:00</pubDate><item><title>小议数据库主键选取策略</title><link>http://www.chinascripts.com/tech/database/sqlserver/2007-11-11/fdcf6eb8b17df455.html</link><description><![CDATA[我们在建立数据库的时候，需要为每张表指定一个主键，所谓主键就是能够唯一标识表中某一行的属性或属性组，一个表只能有一个主键，但可以有多个候选索引。因为主键可以唯一标识某一行记录，所以可以确保执行数据更新、删除的时候不会出现张冠李戴的错误。当然，其它字段可以辅助我们在执行这些操作时消除共享冲突，不过就不在这里讨论了。主键除了上述作用外，常常与外键构成参照完整性约束，防止出现数据不一致。所以数据库在设计时，主键起到了很重要的作用。]]></description><pubDate>2007-11-11 23:35:25</pubDate></item><item><title>获得所有表信息的SQL语句</title><link>http://www.chinascripts.com/tech/database/sqlserver/2007-08-31/e8d20c49c8c812ab.html</link><description><![CDATA[获得所有表信息的SQL语句...]]></description><pubDate>2007-8-31 18:43:52</pubDate></item><item><title>sql server中group by 的几种用法</title><link>http://www.chinascripts.com/tech/database/sqlserver/2007-07-25/6aa78abb78e4eefd.html</link><description><![CDATA[<p><font face="Courier New">Group by 是SQL Server 中常用的一种语法，语法如下：</font></p>
<pre><font color="#0000ff">[ GROUP BY [ ALL ] group_by_expression [ ,...n ]
&nbsp;&nbsp;&nbsp;&nbsp;[ WITH { CUBE | ROLLUP } ]
]</font> </pre>]]></description><pubDate>2007-7-25 23:57:07</pubDate></item><item><title>Sql Server基本函数</title><link>http://www.chinascripts.com/tech/database/sqlserver/2007-06-12/45b9329d682c87a5.html</link><description><![CDATA[<p><span class="Title">1.字符串函数 <br />
</span></p>
<p>长度与分析用 <br />
<br />
datalength(Char_expr) 返回字符串包含字符数,但不包含后面的空格 <br />
<br />
substring(expression,start,length) 不多说了,取子串 <br />
<br />
right(char_expr,int_expr) 返回字符串右边int_expr个字符 <br />
<br />
字符操作类 <br />
<br />
upper(char_expr) 转为大写 <br />
<br />
lower(char_expr) 转为小写 <br />
<br />
space(int_expr) 生成int_expr个空格 <br />
<br />
replicate(char_expr,int_expr)复制字符串int_expr次 <br />
<br />
reverse(char_expr) 反转字符串 <br />
<br />
stuff(char_expr1,start,length,char_expr2) 将字符串char_expr1中的从 <br />
<br />
start开始的length个字符用char_expr2代替 <br />
<br />
ltrim(char_expr) rtrim(char_expr) 取掉空格 <br />
<br />
ascii(char) char(ascii) 两函数对应,取ascii码,根据ascii吗取字符 <br />
<br />
字符串查找 <br />
<br />
charindex(char_expr,expression) 返回char_expr的起始位置 <br />
<br />
patindex(&quot;%pattern%&quot;,expression) 返回指定模式的起始位置,否则为0 </p>]]></description><pubDate>2007-6-12 0:02:54</pubDate></item><item><title>将SQL SERVER中所有表的列信息显示出来</title><link>http://www.chinascripts.com/tech/database/sqlserver/2007-05-14/65efbcd7048aeb3f.html</link><description><![CDATA[<p><font color="#000000">正在作一个关于SQL SERVER数据库导入Excel文件的程序，要读取数据库中的列的信息，从网上找了很多资料，终于总结出来比较理想的sql语句，执行后返回的列分别是：表名、列名、列类型、列长度、列描述、是否主键，语句如下：</font></p>
<p><font color="#000000">SELECT SysObjects.Name as tb_name, SysColumns.Name as col_name, SysTypes.Name as col_type, SysColumns.Length as col_len, isnull(SysProperties.Value,SysColumns.Name) as col_memo,<br />
case when SysColumns.name in <br />
(select 主键=a.name<br />
FROM syscolumns a<br />
&nbsp;inner join sysobjects b on a.id=b.id&nbsp;&nbsp; and b.xtype='U' and&nbsp; b.name&lt;&gt;'dtproperties'<br />
&nbsp;where&nbsp;&nbsp; exists(SELECT 1 FROM sysobjects where xtype='PK' and name in (<br />
&nbsp; SELECT name FROM sysindexes WHERE indid in(<br />
&nbsp;&nbsp; SELECT indid FROM sysindexkeys WHERE id = a.id AND colid=a.colid<br />
&nbsp; ))) <br />
and&nbsp; b.name=SysObjects.Name <br />
)<br />
&nbsp;then 1 else 0 end as is_key</font></p>
<p><font color="#000000">&nbsp;FROM SysObjects,SysTypes,SysColumns <br />
LEFT JOIN SysProperties ON (Syscolumns.Id = Sysproperties.Id AND<br />
&nbsp;Syscolumns.Colid = Sysproperties.Smallid)</font></p>
<p><font color="#000000">&nbsp;WHERE (Sysobjects.Xtype ='u' OR Sysobjects.Xtype ='v') <br />
AND Sysobjects.Id = Syscolumns.Id AND SysTypes.XType = Syscolumns.XType <br />
AND SysTypes.Name &lt;&gt; 'sysname' AND Sysobjects.Name Like '%' ORDER By SysObjects.Name, SysColumns.colid </font></p>
<p><font color="#000000">如果只想操作一个表的，那么把最后的％换成表名就可以了。</font></p>]]></description><author>guanvee</author><pubDate>2007-5-14 15:05:50</pubDate></item><item><title>SQL Server 2000中的触发器使用</title><link>http://www.chinascripts.com/tech/database/sqlserver/2007-04-17/ce64cf95ff0ee857.html</link><description><![CDATA[SQL Server 2000中的触发器使用]]></description><pubDate>2007-4-17 21:53:27</pubDate></item><item><title>SQL Server各种日期计算方法</title><link>http://www.chinascripts.com/tech/database/sqlserver/2007-04-17/607a36ff61851ba0.html</link><description><![CDATA[SQL Server各种日期计算方法]]></description><author>xpilot</author><pubDate>2007-4-17 0:00:56</pubDate></item><item><title>Ms SqlServer查询分页</title><link>http://www.chinascripts.com/tech/database/sqlserver/2007-01-26/7bc318c12d2c88e4.html</link><description><![CDATA[ ]]></description><author>海纳百川</author><pubDate>2007-1-26 11:41:47</pubDate></item><item><title>SQL：JOIN之完全用法</title><link>http://www.chinascripts.com/tech/database/sqlserver/2006-12-05/79f2589b6096787c.html</link><description><![CDATA[ ]]></description><author>unknow</author><pubDate>2006-12-5 17:14:41</pubDate></item><item><title>SQL查询语句精华使用简要</title><link>http://www.chinascripts.com/tech/database/sqlserver/2006-12-05/b85fdee9c4a02e56.html</link><description><![CDATA[ ]]></description><author>okook</author><pubDate>2006-12-5 15:35:30</pubDate></item><item><title>SQL Server中易混淆的数据类型</title><link>http://www.chinascripts.com/tech/database/sqlserver/2006-11-30/554b838cbd9121e6.html</link><description><![CDATA[ ]]></description><author>ss_yingzi</author><pubDate>2006-11-30 17:52:12</pubDate></item><item><title>SQLSERVER存储过程入门与提高</title><link>http://www.chinascripts.com/tech/database/sqlserver/2006-11-10/cf8ed9eff6341ff7.html</link><description><![CDATA[ ]]></description><author>unknow</author><pubDate>2006-11-10 16:50:13</pubDate></item><item><title>Transact_SQL小手册</title><link>http://www.chinascripts.com/tech/database/sqlserver/2006-11-02/7329c3bfa4254597.html</link><description><![CDATA[ ]]></description><author>myclife（收藏）</author><pubDate>2006-11-2 23:52:24</pubDate></item></channel></rss>