|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 11:05 AM
Points: 11,620,
Visits: 27,682
|
|
I've been fiddling around with some cutesy export functions via CLR; I've been able to use Visual Studio to deploy my project, and I can also script stuff out and pass the path to the dll i created;
i've seen some other TSQL only deployment scritps that look something like this:
CREATE ASSEMBLY [RegEx] AUTHORIZATION [dbo] FROM 0x4D5A900{snip!} WITH PERMISSION_SET = SAFE
How can you generate the suite of commands to deploy a dll that way? all i can think of is the "hard" way, of loading the dll as a varbinary, then selecting it and copy pasting the value, and hten adding all the scripts for each procedure in the dll.
is there an easier way?
/****** Object: StoredProcedure [dbo].[CLR_ExportTableToHTML] Script Date: 02/27/2012 09:28:31 ******/ CREATE PROCEDURE [dbo].[CLR_ExportTableToHTML] @TableName [nvarchar](4000), @FilePath [nvarchar](4000), @IncludeHeaders [int], @FileName [nvarchar](4000), @Title [nvarchar](4000), @Summary [nvarchar](4000), @HTMLStyle [int] WITH EXECUTE AS CALLER AS EXTERNAL NAME [Lowell.FavoriteCLRS].[Lowell.FavoriteCLRS.FavoriteCLRs].[CLR_ExportTableToHTML] GO
EXEC sys.sp_addextendedproperty @name=N'AutoDeployed', @value=N'yes' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'PROCEDURE',@level1name=N'CLR_ExportTableToHTML' GO
EXEC sys.sp_addextendedproperty @name=N'SqlAssemblyFile', @value=N'FavoriteCLRs.vb' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'PROCEDURE',@level1name=N'CLR_ExportTableToHTML' GO
EXEC sys.sp_addextendedproperty @name=N'SqlAssemblyFileLine', @value=252 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'PROCEDURE',@level1name=N'CLR_ExportTableToHTML' GO
Lowell
--There is no spoon, and there's no default ORDER BY in sql server either. Actually, Common Sense is so rare, it should be considered a Superpower. --my son
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 5:16 AM
Points: 1,196,
Visits: 1,319
|
|
If you select the Build...Deploy option in VS (at least in VS 2010), then Visual studio creates the deployment .SQL in the bin/debug or bin/release directory along with your DLL. Just edit that file to create your deployment script.
However you do need a local database where the deployment will work.
Or you can load the assembly into a local database as a DLL file, then select the binary from sys.assembly_files - the content field is the binary you are looking for.
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 11:05 AM
Points: 11,620,
Visits: 27,682
|
|
Tom Brown (3/21/2012)
If you select the Build...Deploy option in VS (at least in VS 2010), then Visual studio creates the deployment .SQL in the bin/debug or bin/release directory along with your DLL. Just edit that file to create your deployment script.
However you do need a local database where the deployment will work.
Or you can load the assembly into a local database as a DLL file, then select the binary from sys.assembly_files - the content field is the binary you are looking for.
Thanks Tom; I also found out after this post that you can right click and script the Assemblies in SSMS; Embarssingly, I was creating the scripts like that manually....loading the dll into a varbinary, selecting it to script....copy paste into my model...
i learned a little bit after this one.
Lowell
--There is no spoon, and there's no default ORDER BY in sql server either. Actually, Common Sense is so rare, it should be considered a Superpower. --my son
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 5:16 AM
Points: 1,196,
Visits: 1,319
|
|
I should have figured. The post was a month old.
Just getting into CLR stuff myself, all sorts of complexities to keep me occupied
|
|
|
|