我正在以这里描述的方式创建C#存储过程:
但是在将SQL CLR C#存储过程安装到SQL 2008中并且在发布后它没有显示在汇编列表中时。生成的脚本如下:
/*
Deployment script for Attend
This code was generated by a tool.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
*/
GO
SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER ON;
SET NUMERIC_ROUNDABORT OFF;
GO
:setvar DatabaseName "Attend"
:setvar DefaultFilePrefix "Attend"
:setvar DefaultDataPath "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\"
:setvar DefaultLogPath "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\"
GO
:on error exit
GO
/*
Detect SQLCMD mode and disable script execution if SQLCMD mode is not supported.
To re-enable the script after enabling SQLCMD mode, execute the following:
SET NOEXEC OFF;
*/
:setvar __IsSqlCmdEnabled "True"
GO
IF N'$(__IsSqlCmdEnabled)' NOT LIKE N'True'
BEGIN
PRINT N'SQLCMD mode must be enabled to successfully execute this script.';
SET NOEXEC ON;
END
GO
USE [$(DatabaseName)];
GO
PRINT N'Update complete.';
GO
还在选项中启用了SQLCMD
答案 0 :(得分:0)
我检查了推荐的CLR文章。虽然它一般很好,但是不需要创建执行简单SELECT语句的CLR对象。
我没有引入 string_split 并且^[a-z0-9]+\.[a-z0-9]+$
上面的代码什么也没做。只打印一些消息,即全部
要将CLR对象的新程序集文件(dll)添加到SQL Server,需要CREATE ASSEMBLY命令。 成功执行Create Assembly命令后,dll将列在 sys.assemblies
中您还需要配置可信赖的财产等。 请查看上面引用的有关CLR程序的两篇文章。 我希望它有所帮助。