Can't Get SQL 2005 CLR to Work!

db , sql server India
  • 12 years ago

    I can't do a simple CLR test. I'm getting: Incorrect syntax near DoWork, see code below.

    Reasearch on the web for this error says set the compatibility level of the database to 90. The database is set to 90.

    What am I doing wrong? Thanks for the help.

    sp_configure 'clr enabled',1
    go
    reconfigure with override
    go

    Successful.

    CREATE ASSEMBLY SprocTest
    FROM 'C:\SprocTest.dll'

    Successful.

    CREATE PROC SprocTest
    AS EXTERNAL NAME SprocTest.Class1.DoWork

    Msg 6505, Level 16, State 1, Procedure SprocTest, Line 2
    Could not find Type 'Class1' in assembly SprocTest.

    Place [ ] around external name

    CREATE PROC SprocTest
    AS EXTERNAL NAME [SprocTest.Class1].DoWork

    Msg 102, Level 15, State 1, Procedure SprocTest, Line 3
    Incorrect syntax near DoWork.

  • 12 years ago

    ANSWER

    EXTERNAL NAME [SprocTest.Class1].DoWork

    needs to be

    EXTERNAL NAME SprocTest.[SprocTest.Class1].DoWork

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” - Brian Kernighan