The MSDN docs contain the list of T-SQL that is either partially supported or not supported.  For example see the following location for CREATE TABLE - http://msdn.microsoft.com/en-us/library/ee336258.aspx

In Elmah's case, the filegroup is not supported on 'create table' ddl.

Use the script below for SQL Azure instead.

/* ------------------------------------------------------------------------
TABLES
------------------------------------------------------------------------ */
IF EXISTS(SELECT * FROM sysobjects WHERE xtype = 'U' AND name = 'ELMAH_Error')
DROP TABLE [dbo].[ELMAH_Error]
GO
CREATE TABLE [dbo].[ELMAH_Error]
(
[ErrorId] UNIQUEIDENTIFIER NOT NULL,
[Application] NVARCHAR(60) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Host] NVARCHAR(50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Type] NVARCHAR(100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Source] NVARCHAR(60) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Message] NVARCHAR(500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[User] NVARCHAR(50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[StatusCode] INT NOT NULL,
[TimeUtc] DATETIME NOT NULL,
[Sequence] INT IDENTITY (1, 1) NOT NULL,
[AllXml] NTEXT COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
)

GO

ALTER TABLE [dbo].[ELMAH_Error] WITH NOCHECK ADD
CONSTRAINT [PK_ELMAH_Error] PRIMARY KEY ([ErrorId])
GO

ALTER TABLE [dbo].[ELMAH_Error] ADD
CONSTRAINT [DF_ELMAH_Error_ErrorId] DEFAULT (NEWID()) FOR [ErrorId]
GO

CREATE NONCLUSTERED INDEX [IX_ELMAH_Error_App_Time_Seq] ON [dbo].[ELMAH_Error]
(
[Application] ASC,
[TimeUtc] DESC,
[Sequence] DESC
)
GO

/* ------------------------------------------------------------------------
STORED PROCEDURES
------------------------------------------------------------------------ */

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

IF EXISTS(SELECT * FROM sysobjects WHERE xtype = 'P' AND name = 'ELMAH_GetErrorXml')
DROP PROCEDURE [dbo].[ELMAH_GetErrorXml]
GO
CREATE PROCEDURE [dbo].[ELMAH_GetErrorXml]
(
@Application NVARCHAR(60),
@ErrorId UNIQUEIDENTIFIER
)
AS

SET NOCOUNT ON

SELECT
[AllXml]
FROM
[ELMAH_Error]
WHERE
[ErrorId] = @ErrorId
AND
[Application] = @Application

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

IF EXISTS(SELECT * FROM sysobjects WHERE xtype = 'P' AND name = 'ELMAH_GetErrorsXml')
DROP PROCEDURE [dbo].[ELMAH_GetErrorsXml]
GO
CREATE PROCEDURE [dbo].[ELMAH_GetErrorsXml]
(
@Application NVARCHAR(60),
@PageIndex INT = 0,
@PageSize INT = 15,
@TotalCount INT OUTPUT
)
AS

SET NOCOUNT ON

DECLARE @FirstTimeUTC DATETIME
DECLARE @FirstSequence INT
DECLARE @StartRow INT
DECLARE @StartRowIndex INT

SELECT
@TotalCount = COUNT(1)
FROM
[ELMAH_Error]
WHERE
[Application] = @Application

-- Get the ID of the first error for the requested page

SET @StartRowIndex = @PageIndex * @PageSize + 1

IF @StartRowIndex <= @TotalCount
BEGIN

SET ROWCOUNT @StartRowIndex

SELECT
@FirstTimeUTC = [TimeUtc],
@FirstSequence = [Sequence]
FROM
[ELMAH_Error]
WHERE
[Application] = @Application
ORDER BY
[TimeUtc] DESC,
[Sequence] DESC

END
ELSE
BEGIN

SET @PageSize = 0

END

-- Now set the row count to the requested page size and get
-- all records below it for the pertaining application.

SET ROWCOUNT @PageSize

SELECT
errorId = [ErrorId],
application = [Application],
host = [Host],
type = [Type],
source = [Source],
message = [Message],
[user] = [User],
statusCode = [StatusCode],
time = CONVERT(VARCHAR(50), [TimeUtc], 126) + 'Z'
FROM
[ELMAH_Error] error
WHERE
[Application] = @Application
AND
[TimeUtc] <= @FirstTimeUTC
AND
[Sequence] <= @FirstSequence
ORDER BY
[TimeUtc] DESC,
[Sequence] DESC
FOR
XML AUTO

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

IF EXISTS(SELECT * FROM sysobjects WHERE xtype = 'P' AND name = 'ELMAH_LogError')
DROP PROCEDURE [dbo].[ELMAH_LogError]
GO
CREATE PROCEDURE [dbo].[ELMAH_LogError]
(
@ErrorId UNIQUEIDENTIFIER,
@Application NVARCHAR(60),
@Host NVARCHAR(30),
@Type NVARCHAR(100),
@Source NVARCHAR(60),
@Message NVARCHAR(500),
@User NVARCHAR(50),
@AllXml NTEXT,
@StatusCode INT,
@TimeUtc DATETIME
)
AS

SET NOCOUNT ON

INSERT
INTO
[ELMAH_Error]
(
[ErrorId],
[Application],
[Host],
[Type],
[Source],
[Message],
[User],
[AllXml],
[StatusCode],
[TimeUtc]
)
VALUES
(
@ErrorId,
@Application,
@Host,
@Type,
@Source,
@Message,
@User,
@AllXml,
@StatusCode,
@TimeUtc
)

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

Using sql azure for Elmah的更多相关文章

  1. [SDK2.2]SQL Azure (13) Azure的两种关系型数据库服务:SQL Azure与SQL Server VM的不同

    <Windows Azure Platform 系列文章目录> 如果熟悉Windows Azure平台的用户不难发现,对于SQL Server数据库来说,微软提供了两种服务,分别是: -W ...

  2. SQL Azure (14) 将云端SQL Azure中的数据库备份到本地SQL Server

    <Windows Azure Platform 系列文章目录> 注意: 1.只有SQL Server 2012 CU4及以上版本才支持本章内容 2.当你的数据库文件很大时,建议优化以下内容 ...

  3. SQL Azure (15) SQL Azure 新的规格

    <Windows Azure Platform 系列文章目录> 在以前的文章中,笔者给大家介绍了Microsoft Azure SQL Database (以前被称为SQL Azure)的 ...

  4. SQL Azure (16) 创建PaaS SQL Azure V12数据库

    <Windows Azure Platform 系列文章目录> 本文介绍的是国内由世纪互联运维的Azure China 最新的Azure PaaS SQL Database(SQL Azu ...

  5. SQL Azure (17) SQL Azure V12 - 跨数据中心标准地域复制(Standard Geo-Replication)

    <Windows Azure Platform 系列文章目录> 熟悉Microsoft Azure平台的读者都了解,Azure SQL Database提供不同等级的,跨数据中心的异地冗余 ...

  6. 怎样将SQL Azure数据库备份到本地或者Storage

    怎样备份SQL Azure数据库到本地或者云存储Storage,可以使用SQL Database Import Export 的功能. 具体操作如下: 用SSMS链接SQL Azure数据库 注意:服 ...

  7. 数据库SQL Server DAC 导入导出数据到SQL Azure问题

    对Export data-tier application报错的处理 Error:SQL71564 这个问题是数据库中一些对象如MS_Description,MS_DiagramPane1不支持DAC ...

  8. 将SQL Azure数据库备份到本地SQL Server 2012

    整个备份过程可以分为如下两大步骤进行: 一.通过“Export Data-tier Application”先将目标SQL Azure的数据库备份到本地,详细步骤如下: 1.启动SQL Server ...

  9. Azure的两种关系型数据库服务:SQL Azure与SQL Server VM的不同

    Azure的两种关系型数据库服务:SQL Azure与SQL Server VM的不同 <Windows Azure Platform 系列文章目录> 如果熟悉Windows Azure平 ...

随机推荐

  1. oracle11g导入到10g

    oracle11g导入到10g http://www.doc88.com/p-0827386468478.html

  2. java高级工程师必备知识

    成为Java高级工程师需要掌握哪些核心点? 每 逢长假都会有很多程序员跳槽,十一.过年是跳槽黄金时刻,尤其是过年.过年的时候年终奖到手,没有了多少牵挂,年终同学同事聚会比较多,沟通的就多,各种 工作机 ...

  3. linux服务方式启动程序脚本(init.d脚本)

    这才是真正正确的让jar后台启动的脚本,网络上的各种nohoup的脚本都是临时执行一次任务用的. #!/bin/sh # # init.d script # # ### BEGIN INIT INFO ...

  4. 18)Java八股文名词

      >VO:   value-object >DTO: Data Transform Object >DTD: Document Type Definition      文档类型定 ...

  5. 【转】DCC32的参数详解

    完整的内容如下: // DCC32编译器的设置说明. // Dcc32 [options] filename [options] // DCC32 [操作选项] 文件名称 [操作选项] // -A&l ...

  6. cxGrid使用汇总(一)

    1. 去掉cxGrid中台头的Box 解决:在tableview1的ptionsview的groupbybox=false; 2.统计功能 解决:(1) tableview 1. tableview1 ...

  7. 在EF的code frist下写稳健的权限管理系统:MVC过滤拦截,权限核心(五)

    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = true, AllowMultiple = ...

  8. Python核心编程--学习笔记--4--Python对象

    现在开始学习Python语言的核心部分.首先了解什么是Python对象,然后讨论最常用的内建类型,接下来讨论标准类型运算符和内建函数,之后给出对标准类型的不同分类方式,最后提一提Python目前还不支 ...

  9. Cygwin下软件安装 - apt-cyg

    安装了cygwin,但不能像centos上装yum,装东西很不方便.找了下可以用apt-cyg来安装软件. 1.下载apt-cyg $ wget raw.github.com/transcode-op ...

  10. Android--用DownLoadManager下载完成后启动安装

    当我们用系统的服务DownLoadManager下载完成后,系统会发送一个广播,我们只需要注册一个广播,然后在广播里面写如一些相应的操作. 1.注册广播 completeReceiver = new ...