SQL Server存储过程的命名标准
在本文中,此示例标准蓝图的存储过程命名方法只适用于SQL内部,假如你正在创建一个新的存储过程,或是发现一个没有按照这个标准构造的存储过程,即可以参考使用这个标准。
注释:假如存储过程以sp_ 为前缀开始命名那么会运行的稍微的缓慢,这是因为SQL Server将首先查找系统存储过程,所以我们决不推荐使用sp_作为前缀。
存储过程的命名有这个的语法:
[proc] [MainTableName] By [FieldName(optional)] [Action]
[ 1 ] [ 2 ] [ 3 ] [ 4 ]
(1) 所有的存储过程必须有前缀'proc'. 所有的系统存储过程都有前缀"sp_", 推荐不使用这样的前缀因为会稍微的减慢。
(2) 表名就是存储过程访问的对象。
(3) 可选字段名就是条件子句。 例如:
procClientByCoNameSelect, procClientByClientIDSelect
(4) 最后的行为动词就是存储过程要执行的任务。
如果存储过程返回一条记录那么后缀是:Select
如果存储过程插入数据那么后缀是:Insert
如果存储过程更新数据那么后缀是:Update
如果存储过程有插入和更新那么后缀是:Save
如果存储过程删除数据那么后缀是:Delete
如果存储过程更新表中的数据 (ie. drop and create) 那么后缀是:Create
如果存储过程返回输出参数或0,那么后缀是:Output
例子:
一个仅仅返回一个输出参数的存储过程:
ALTER PROCEDURE procClientRateOutput
@pstrClientID VARCHAR(6) = 'CABLE',
@pstrCategoryID VARCHAR(6) = '<All>',
@pstrEmpID VARCHAR(6)='AC',
@pdteDate datetime = '1996/1/1',
@curRate MONEY OUTPUT
AS
-- Description: Get the $Rate for this client and this employee
-- and this category from Table ClientRate
SET @curRate = (
SELECT TOP 1 Rate
from ClientRate
&n
相关文档:
index.jsp
<%@ page language="java" import="java.sql.*" import="java.lang.*" import="java.util.*" pageEncoding="GB2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%!
& ......
一、SQL SERVER 和ACCESS的数据导入导出
常规的数据导入导出:
使用DTS向导迁移你的Access数据到SQL Server,你可以使用这些步骤:
○1在SQL SERVER企业管理器中的Tools(工具)菜单上,选择Data Transformation
○2Services(数据转换服务),然后选择 czdImport Dat ......
作者: 三十而立时间:2009年10月15日 19:21:13本文出自 “inthirties(三十而立)”博客,转载请务必注明作者和保留出处http://blog.csdn.net/inthirties/archive/2009/10/15/4673331.aspx 学习是枯燥的,所以作为一个学习者,要学会在学习中找到快乐,这样才能激发兴趣,兴趣是最好的老师,这样,学习就慢慢的变成了一件 ......
select * from student where name=?;
如果不用单引号引起来, pstmt.setString(1,"xx or 1=1");即sql应该就是select * from student where name=xx or 1=1就可以全部查出。
强制单引号引起来,select * from student where name='xx or 1=1'。就无效了。
数值型的没有要求用单引号引起来,应该是由于有一个转换过 ......
SQL Server Filtered Indexes - What They Are, How to Use and Performance Advantages
Written By: Arshad Ali -- 7/2/2009 -
Problem
SQL Server 2008 introduces Filtered Indexes which is an index with a WHERE clause. Doesn’t it sound awesome especially for a table that has huge amount of data and ......