SQL2008:“Microsoft.SqlServer.Management.Dmf.PolicyStore”的类型初始值设定项引发异常

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SQL2008:“Microsoft.SqlServer.Management.Dmf.PolicyStore”的类型初始值设定项引发异常相关的知识,希望对你有一定的参考价值。

在大多数情况下,卸载Visual Studio和。NET 4和重新安装它们可以解决。
如果还不解决这个问题,你可以按照下面的步骤来解决此错误:
1。运行命令提示符,然后找到的DLL文件的位置,使用以下命令:
DIR Microsoft.SqlServer.Diagnostics.STrace.dll/ S

2。复制DLL的名称与位置。

3。以管理员身份运行VS 2008的命令提示符。

4。执行以下命令

GACUTIL- I“Microsoft.SqlServer.Diagnostics.STrace.dll 在第1步找到的完整路径”

如果在您的系统缺少DLL文件Microsoft.SqlServer.Diagnostics.STrace.dll,你可以复制从其他的地方。
参考技术A “Microsoft.SqlServer.Management.Dmf.PolicyStore”的类型初始值设定项引发异常。 (Microsoft.SqlServer.Dmf)
------------------------------

对版本将Microsoft.SqlServer.Diagnostics.STrace.dll复制到C:\Program
Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE这个目录 即可。

sql sql.sql

-- pripravime si temporary tabulku pro manipulaci s cenami, dovolime NULL ID (jinak to cele nebude fungovat)
DROP TEMPORARY TABLE IF EXISTS credit_voucher;

CREATE TEMPORARY TABLE credit_voucher LIKE `pricelist`;
CREATE TEMPORARY TABLE credit_backup_top LIKE `pricelist`;

ALTER TABLE credit_voucher
  DROP KEY `PRIMARY`,
  CHANGE `id` `id` INT(11) UNSIGNED NULL DEFAULT NULL;

ALTER TABLE credit_backup_top
  DROP KEY `PRIMARY`,
  CHANGE `id` `id` INT(11) UNSIGNED NULL DEFAULT NULL;

-- vezmeme si aktualni ceny pro 150GB pro CZ i SK, celkem 18
INSERT INTO credit_voucher
  SELECT *
  FROM pricelist
  WHERE
    valid_to IS NULL
    AND `data_amount` = 150000000
    AND `sms_number` IS NULL
    AND country IN ('CZ', 'SK'); -- 9x od kazde;


INSERT INTO credit_backup_top
  SELECT *
  FROM pricelist
  WHERE
    valid_to IS NULL
    AND `data_amount` = 70000000
    AND `sms_number` IS NULL
    AND is_highlighted = 1
    AND country IN ('CZ', 'SK'); -- 9x od kazde;


BEGIN;
-- deaktivujeme puvodni ceny
UPDATE `pricelist`
SET `valid_to` = NOW()
WHERE `id` IN (
  SELECT `id`
  FROM credit_voucher
);

-- pripravime si kopii puvodnich cen, ktere budou platne od noveho roku
UPDATE credit_voucher
SET id = NULL, archived_id = NULL, valid_to = NULL, valid_from = '2017-01-01 00:00:00';

-- nasypeme pripravene nove ceny do tabulky
INSERT INTO `pricelist`
  SELECT *
  FROM credit_voucher;

-- pripravime cepickovou polozku
UPDATE credit_voucher
SET valid_from = NOW(), valid_to = '2017-01-01 00:00:00', is_highlighted = 1;

-- zlavime to nam
UPDATE credit_voucher
SET `price` = 18
WHERE `country` = 'SK';

-- aj bratom Čechom
UPDATE credit_voucher
SET `price` = 399
WHERE `country` = 'CZ';


-- nasypeme pripravene nove ceny do tabulky
INSERT INTO `pricelist`
  SELECT *
  FROM credit_voucher;




-- vytvoreni top polozek pro 70GB od ledna a deaktivace top polozek pro obdobi NOW() - novy rok

-- deaktivujeme puvodni ceny
UPDATE `pricelist`
SET `valid_to` = NOW()
WHERE `id` IN (
  SELECT `id`
  FROM credit_backup_top
);

-- pripravime si kopii puvodnich cen, ktere budou platne od noveho roku
UPDATE credit_backup_top
SET id = NULL, archived_id = NULL, valid_to = NULL, valid_from = '2017-01-01 00:00:00';

-- nasypeme pripravene nove ceny do tabulky
INSERT INTO `pricelist`
  SELECT *
  FROM credit_backup_top;


-- nasypeme pripravene nove ceny do tabulky
INSERT INTO `pricelist`
  SELECT *
  FROM credit_backup_top;


-- udelame z top 70GB polozek obycejne polozky
UPDATE credit_backup_top
SET valid_from = NOW(), valid_to = '2017-01-01 00:00:00', is_highlighted = 0;


-- nasypeme pripravene nove ceny do tabulky
INSERT INTO `pricelist`
  SELECT *
  FROM credit_backup_top;

-- vsechno se povedlo :)
COMMIT;

-- uklid
DROP TEMPORARY TABLE credit_voucher;

以上是关于SQL2008:“Microsoft.SqlServer.Management.Dmf.PolicyStore”的类型初始值设定项引发异常的主要内容,如果未能解决你的问题,请参考以下文章

sql 2008 r2 在sql 2008上兼容么

sql 2008和sql 2012的区别

SQL2008和sql2008 r2有啥区别

sql 2008 能还原2012的库吗

为啥安装的SQL SERVER 2008中SQL SERVER 服务只有1个

用sql2008写的数据库如何能附加到sql2005上?