cnblogs/dcrenl/SQL语法.html
2024-09-24 12:43:01 +08:00

63 lines
1.9 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div id="sina_keyword_ad_area2" class="articalContent ">
<div>
<div>distinct :去掉查询结果集中的重复记录 例如:SELECT &nbsp;DISTINCT&nbsp;* &nbsp; FROM&nbsp;Table</div>
<div><br />
</div>
<div>truncate table : 清空表,自增ID重新开始 例: TRUNCATE TABLETablename</div>
<div><br />
</div>
<div>INSERT INTO 后使用SELECT @@IDENTITY 会反回自增ID</div>
<div><br />
</div>
<div>DUMP TRANSACTION JobIntern WITH NO_LOG删除数据库日志2008中已取消这个功能</div>
</div>
<div><br />
</div>
<div><span style="font-family: 'Segoe UI',Verdana,Arial; font-size: 12px;"><span style="line-height: normal;">返回受上一语句影响的行数。如果行数大于 20亿请使用</span></span><a href="http://msdn.microsoft.com/zh-cn/library/ms181406(v=SQL.90).aspx" target="_blank">ROWCOUNT_BIG</a></div>
<div>
<div>
<div>UPDATE t_pub_param SET ParamValue = @ParamValue WHEREParamName = @ParamName</div>
<div>IF @@rowcount &lt; 1</div>
<div>BEGIN</div>
<div>INSERT t_pub_param(ParamName, ParamValue) values(@ParamName,@ParamValue)</div>
<div>END</div>
</div>
</div>
<div><br />
</div>
<div>EXISTS指定一个子查询检测行的存在</div>
<div>
<div>if(exists(select * from&nbsp; <span style="line-height: 21px;">t_pub_param&nbsp;</span>where&nbsp;<span style="line-height: 21px;">ParamValue= @ParamValue</span>&nbsp;))</div>
<div>BEGIN</div>
<div>SET @re = 1</div>
<div>END</div>
<div><br />
</div>
<div>
<div>ISDATE() &nbsp;--函数判断所给定的表达式是否为合理日期</div>
<div>语法</div>
<div>ISDATE ( expression )</div>
<div>参数</div>
<div>expression</div>
<div>一个表达式将要验证它是否为一个日期。expression 是任何返回 varchar 数据类型的表达式。</div>
</div>
<div>返回值</div>
<div>0表示非日期类型空串[''],空值[null]都为0</div>
<div>1表示日期类型</div>
<div><br />
</div>
</div>
</div>
<p>&nbsp;</p>