易截截图软件、单文件、免安装、纯绿色、仅160KB

sqlserver 存储过程

create database db
use db
create table sampleTable
(
 fId int identity(1,1)  primary key,
 fName varchar(10),
 fGrade int,
)
select * from sampleTable
insert into sampleTable values ('张柏',69);
insert into sampleTable values ('李玉梅',100);
insert into sampleTable values ('李四',100);
--普通存储过程
create proc queryInfo
as
  select * from sampleTable
go
drop proc queryInfo
exec queryInfo
--传入参数--
create proc idIn
@id int
as
  select * from sampleTable where fid =@id
go
drop proc idIn
exec idIn 1
--传入参数--
create proc nameIn
@name varchar(10)
as
  select * from sampleTable where fname =@name
go
exec nameIn '张柏'
--传入、传出参数--
create proc nameOut
@id int,
@name varchar(10) output
as
begin
  select @name=fname from sampleTable where fid =@id
end
drop proc nameOut
declare @name varchar(10)
exec nameOut 1,@name output
select @name
--带通配符的参数
create proc qwnbcOut
@name varchar(10) ='张%'
as
begin
  select * from sampleTable where fname like @name
end
drop proc qwnbcOut
exec qwnbcOut '李%'


相关文档:

oracle与sqlserver执行count(*)返回的结果兼容

由于以前都是在sqlserver 2005处理,现在客户要求oracle数据库服务器,
最初的代码为:
allRecordSize = (Integer) rs1.getObject(1);    //Integer allRecordSize=0;
当执行的时候报:BigDecimal无法转化为Integer类型
为了兼容两者修改后的代码为:
  Object o = rs1.getObject(1);
 &nbs ......

SQLServer的CONVERT函数介绍

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/yf520gn/archive/2008/09/26/2982363.aspx
SELECT * from TB_MILES_CB_ORDER
WHERE convert(varchar(100),ORDER_DATE,102)= ?
ORDER BY ORDER_NO
SELECT CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
SELECT CONVERT(varchar(100), GETDATE ......

sqlserver:openrowset / oracle:table/view@dblink名

只是sqlserver 提供的远程数据访问函数;  在本地sqlserver 中取外部数据源数据时候可用;
对连接本地 oracle 操作远程 oracle 不能使用; 测试: pl/sql 中使用:
select * from openrowset(................); 无效!!!!!!!!!!!!!!
在oracle 中需要访问远程数据,需要建立一连接远程oracle 的 dblink ;
再用如下方 ......

使用SQLServer模板来写规范的SQL语句

如果你经常遇到下面的问题,你就要考虑使用SQL Server的模板来写规范的SQL语句了:
SQL初学者。
经常忘记常用的DML或是DDL SQL 语句。
在多人开发维护的SQL中,每个人都有自己的SQL习惯,没有一套统一的规范。
在SQL Server Management Studio中,已经给大家提供了很多常用的现成SQL规范模板。
SQL Server Management ......

java 调用通用存储过程(Sqlserver)


package com.wfy.system.dao;   
  
import java.sql.CallableStatement;   
import java.sql.Connection;   
import java.sql.ResultSet;   
import java.sql.SQLException;   
import java.sql.Types;    ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号