????????????洢????????????????sql?????????????????????????????????ò??????????????????????????????洢?????洢???????????????????????????????????
?????:?洢???????
????SQL Server?е?洢?????????T_SQL??д?????Ρ??????????????????????????в?????????????????????????????????????????????????????.T_SQL?????SQL Server?????????ó????????????????????£??Щ????????????????д??Σ??????ζ???д?????????????????????????????????????????SQL Server???????????????????????Ч???
?????????????洢??????SQL Server??????????????????Щ?????ε??????????????д?????Σ???Щ????δ洢??????????????????????????????????á?
?????洢????????:
?????洢?????????????????洢?????????????????????????????????±???
?????洢???????????????????????????????????????????????£???????
???????????黯??????????洢????????ε??????????????????????????ó???????????
?????洢??????????????????????????????????????洢??????????????SQL Server?????趨?????????洢????????????
?????洢?????????????????????洢??????????洢????????У???????????????????????У??????????????T_SQL??????????
?????洢????????
???????????????????洢?????????????????????? SQL Server ?洢?????з??????????????????????????????????????С?
????????????????????????????????????????????????з?????????γ??????????????????????.
???????????????????????????????
?????????洢???????
????1.???洢????
???????洢?????? SQL Server??????????洢??????????????????и????????
???????洢??????????????????л?????????????洢??????????????????????????????????????????????????????????????????洢????λ?????????????У???????sp_????????洢??????????????????????????????У?????????????洢??????????????????????磺sp_rename???洢????????????????????????????????????sp_helptext?洢?????????????????????????????????SQL SERVER???????????????????????????????洢?????????????????????????????????洢????????á?
???????洢???????????????????????master?У??Щ???洢????????????????????????Щ???洢??????????????????????????á?
????2.????洢????(?????洢????)
?????????洢???????????T_SQL????д????????????????????????????????б?д??T_SQL??伯????????洢????????????????????????????????????????????????????????????洢????????洢???????????”##”????????????????????洢????;?洢??????????”#”??????????????????洢????????????洢????????????????????????????????????????????????洢??????洢??tempdb??????С?
????????????洢??????????T_SQL ??CLR
????T_SQL:?洢????????????T_SQL??伯???????????????????????????洢???????????????????????ó??????????
????CLR?洢???????????Microsoft.NET Framework?????????????洢??????????????????????????????????.NET Framework???????????????????????????
????3.????洢????
????????洢??????????SQL SERVER????????е???????(DLL???)???????????????SQL SERVER??????е??????????У?????洢?????????SQL SERVER????洢????API????????洢????????”xp_”???????????????????????洢???????????洢???????????????????????????С?
?????????????洢????
?????????????£????????????????????????:
????use sample_db;
????--????????books??
????create table books (
????book_id int identity(1??1) primary key??
????book_name varchar(20)??
????book_price float??
????book_auth varchar(10)
????);
????--???????????
????insert into books (book_name??book_price??book_auth)
????values
????('????'??25.6??'????')??
????('???????'??25.6??'???')??
????('?????'??32.7??'???')??
????('?????????'??35.8??'·?')??
????('???'??54.8??'????');