SQL Server?洢?????д
???????????? ???????[ 2015/2/9 13:43:26 ] ????????????? SQL ?洢????
????9?? ???α?????洢????
if (object_id('proc_cursor'?? 'P') is not null)
drop proc proc_cursor
go
create proc proc_cursor
@cur cursor varying output
as
set @cur = cursor forward_only static for
select id?? name?? age from student;
open @cur;
go
--????
declare @exec_cur cursor;
declare @id int??
@name varchar(20)??
@age int;
exec proc_cursor @cur = @exec_cur output;--????洢????
fetch next from @exec_cur into @id?? @name?? @age;
while (@@fetch_status = 0)
begin
fetch next from @exec_cur into @id?? @name?? @age;
print 'id: ' + convert(varchar?? @id) + '?? name: ' + @name + '?? age: ' + convert(char?? @age);
end
close @exec_cur;
deallocate @exec_cur;--????α?
????10?? ????洢????
---?洢?????row_number?????
if (object_id('pro_page'?? 'P') is not null)
drop proc proc_cursor
go
create proc pro_page
@startIndex int??
@endIndex int
as
select count(*) from product
;
select * from (
select row_number() over(order by pid) as rowId?? * from product
) temp
where temp.rowId between @startIndex and @endIndex
go
--drop proc pro_page
exec pro_page 1?? 4
--
--????洢????
if (object_id('pro_page'?? 'P') is not null)
drop proc pro_stu
go
create procedure pro_stu(
@pageIndex int??
@pageSize int
)
as
declare @startRow int?? @endRow int
set @startRow = (@pageIndex - 1) * @pageSize +1
set @endRow = @startRow + @pageSize -1
select * from (
select *?? row_number() over (order by id asc) as number from student
) t
where t.number between @startRow and @endRow;
exec pro_stu 2?? 2;
· Raiserror
????Raiserror??????????????????????????????????????????????????????????
?????????£?
????Raiserror({msg_id | msg_str | @local_variable}
????{?? severity?? state}
????[??argument[??…n]]
????[with option[??…n]]
????)
????# msg_id:??sysmessages????????????????????????
????# msg_str:??????????????????????2047???????
????# severity?????????????????????????????????msg_id???????sp_addmessage???????????????????raiserror????????????????sp_addmessage?ж???????????
?????κ???????????0-18??????????????sysadmin????????????????????alter trace??????????????19-25???????????19-25????????????????with log??
????# state??????1??127?????κ???????State??????1??
????raiserror('is error'?? 16?? 1);
????select * from sys.messages;
????--???sysmessages?ж???????
????raiserror(33003?? 16?? 1);
????raiserror(33006?? 16?? 1);
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
?????????????????????????Щ????????????????????TC???????????????Щ???????????????????????????????????????????????(java .net ?????)???mysql???????????????????ж????д???Python???????????????(DB2)??????BufferPool????????????????????????????????6??????????????????滮???????????????-????????SQL Server???????????????????λ?????PHP??SQL????????????????????Pythonд???NoSQL????????? SQL ?е????????????? SQL ?е?????????Java???????:?????MySQL???????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????