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 'Àî%'
Ïà¹ØÎĵµ£º
1.Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)¡¡¡¡
¡¡¡¡ SQLSERVERµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬Òò´Ëfrom×Ó¾äÖÐдÔÚ×îºóµÄ±í£¨»ù´¡±ídriving table£©½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏ£¬±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í£¬µ±SQLSERVER´¦Àí¶à¸ö±íʱ£¬»áÔËÓÃÅÅÐò¼°ºÏ²¢µÄ·½Ê½Á ......
Èç¹ûÄã¾³£Óöµ½ÏÂÃæµÄÎÊÌ⣬Äã¾ÍÒª¿¼ÂÇʹÓÃSQL ServerµÄÄ£°åÀ´Ð´¹æ·¶µÄSQLÓï¾äÁË£º
SQL³õѧÕß¡£
¾³£Íü¼Ç³£ÓõÄDML»òÊÇDDL SQL Óï¾ä¡£
ÔÚ¶àÈË¿ª·¢Î¬»¤µÄSQLÖУ¬Ã¿¸öÈ˶¼ÓÐ×Ô¼ºµÄSQLÏ°¹ß£¬Ã»ÓÐÒ»Ì×ͳһµÄ¹æ·¶¡£
ÔÚSQL Server Management StudioÖУ¬ÒѾ¸ø´ó¼ÒÌṩÁ˺ܶೣÓõÄÏÖ³ÉSQL¹æ·¶Ä£°å¡£
SQL Server Management ......
SQLServer2005ͨ¹ýintersect,union,exceptºÍÈý¸ö¹Ø¼ü×Ö¶ÔÓ¦½»¡¢²¢¡¢²îÈýÖÖ¼¯ºÏÔËËã¡£
ËûÃǵĶÔÓ¦¹Øϵ¿ÉÒԲο¼ÏÂÃæͼʾ
Ïà¹Ø²âÊÔʵÀýÈçÏ£º
use tempdb
go
if (object_id ('t1' ) is not null ) drop table t1
if (object_id ('t2' ) is not null ) drop table t2
go
cre ......
Ò» ÔÚOracleÖÐÁ¬½ÓÊý¾Ý¿â
public class Test1 {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection(
&nbs ......
SQL ServerÊý¾Ý¿âÉè¼Æ±íºÍ×Ö¶Î
2009/02/18 12:29
1. Ôʼµ¥¾ÝÓëʵÌåÖ®¼äµÄ¹Øϵ
¡¡¡¡¿ÉÒÔÊÇÒ»¶ÔÒ»¡¢Ò»¶Ô¶à¡¢¶à¶Ô¶àµÄ¹Øϵ¡£ÔÚÒ»°ãÇé¿öÏ£¬ËüÃÇÊÇÒ»¶ÔÒ»µÄ¹Øϵ£º¼´Ò»ÕÅÔʼµ¥¾Ý¶ÔÓ¦ÇÒÖ»¶ÔÓ¦Ò»¸öʵÌå¡£ÔÚÌØÊâÇé¿öÏ£¬ËüÃÇ¿ÉÄÜÊÇÒ»¶Ô¶à»ò¶à¶ÔÒ»µÄ¹Øϵ£¬¼´Ò»ÕÅÔʼµ¥Ö¤¶ÔÓ¦¶à¸öʵÌ壬»ò¶àÕÅÔʼµ¥Ö¤¶ÔÓ¦Ò»¸öʵÌå¡£ÕâÀïµÄʵÌå¿ ......