함수만들기
create function hap(@kor int, @eng int, @mat int) returns int as begin return (@kor+@eng +@mat) end
select dbo.hap(100,100,100)
sp_helptext hap

drop table tblsungjuk
create table tblsungjuk(num int, name varchar(20), kor smallint, eng smallint, mat smallint, tot as (dbo.hap(kor,eng,mat)))
sp_columns tblsungjuk

insert into tblsungjuk values(1, '이하영', 100,100,100)
insert into tblsungjuk values(2, '권예진', 90,100,100)
select * from tblsungjuk

create function sungjuksearch(@jum smallint) returns table as return (select * from tblsungjuk where kor > @jum)
select * from dbo.sungjuksearch(90)

select * into newtblsungjuk from tblsungjuk where 1= 0
select * from newtblsungjuk
insert into newtblsungjuk select *  from tblsungjuk
select * from newtblsungjuk
drop function  largeordershippers

'정리없는자료 > DB' 카테고리의 다른 글

MS-SQL 국가 통계 IP  (0) 2007.12.22
MS-SQL Transation, Lock  (0) 2007.10.26
MS-SQL 함수만들기  (0) 2007.10.23
MS-SQL 저장 프로시저 + 테이블  (0) 2007.10.23
MS-SQL with check option(범위 지정)  (0) 2007.10.23
MS-SQL index,partitioned view  (0) 2007.10.23

+ Recent posts