Options

Pre script running issue

SatishSatish Posts: 2
edited December 21, 2011 4:01PM in SQL Packager Previous Versions
Hi,

we ran into a problem while using the Red-Gate SQL Packager 6.4.0.8
We built a package and tried running it on a server where the packager is supposed to create a new database. The problem occurred when the packager tried to install a .net assembly file(dll) into the newly created database.
It threw an error that said
“CREATE ASSEMBLY for assembly 'Delta.SQLCLR' failed because assembly 'Delta.SQLCLR' is not authorized for PERMISSION_SET = UNSAFE. The assembly is authorized when either of the following is true: the database owner (DBO) has UNSAFE ASSEMBLY permission and the database has the TRUSTWORTHY database property on; or the assembly is signed with a certificate or an asymmetric key that has a corresponding login with UNSAFE ASSEMBLY permission.”
This could be fixed by using the statement “SET TRUSTWORTHY ON” on the newly created db.
But when we made the above script a part of the preSQL script and ran the packager in command line, it did not seem to have executed the above script and came back with the same error.

Comments

  • Options
    Thanks for your post.
    The /presql is run before the database is created, so it won't have actually made the change you expect.

    One option would be to create the DB as part of your Pre-script, for instance if I wanted to create a table first:
    USE master
    GO
    CREATE DATABASE pkg2
    GO
    USE packagerDB
    GO
    CREATE TABLE test
    (
    id INT NOT NULL ,
    rowdata VARCHAR(200)
    )
    GO
    

    Then, in your commandline, specify the DB you just created and the /makeupgrade switch as opposed to the /makedatabase switch.

    Hopefully that should help get around the problem.
    Systems Software Engineer

    Redgate Software

Sign In or Register to comment.