在sql server中创建视图时出错

时间:2014-12-19 09:04:43

标签: sql-server

我是SQL Server视图创建的新手。

在我的项目中,需要在sql server中创建视图(View_SalesOrder),该视图应与另一个名为View_Quotation的视图完全相同。

它应该只是将'Quotation'替换为'SalesOrder'。

当我这样做时,它会创建视图但出现以下错误消息

Msg 15097, Level 16, State 1, Procedure sp_addextendedproperty, Line 16
The size associated with an extended property cannot be more than 7,500 bytes.

我的View_SalesOrder是

USE [MehtechDb]
GO

/****** Object:  View [dbo].[View_SalesOrder]    Script Date: 12/19/2014 12:35:48 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

create VIEW [dbo].[View_SalesOrder]
AS
SELECT     dbo.tbl_SalesOrderHeader.Refno, dbo.tbl_SalesOrderHeader.RefNoDate, dbo.tbl_SalesOrderHeader.Authorised, dbo.tbl_SalesOrderHeader.ClientCompanyName, 
                      dbo.tbl_SalesOrderHeader.ClientBranch, dbo.tbl_SalesOrderHeader.ClientPerson, dbo.tbl_SalesOrderHeader.TypeOfEnquiry, dbo.tbl_SalesOrderHeader.EnquiryDate, 
                      dbo.tbl_SalesOrderHeader.DueDate, dbo.tbl_SalesOrderHeader.Delivery, dbo.tbl_SalesOrderHeader.PF, dbo.tbl_SalesOrderHeader.Tax, dbo.tbl_SalesOrderHeader.Payment, 
                      dbo.tbl_SalesOrderHeader.Validity, dbo.tbl_SalesOrderHeader.Frieght, dbo.tbl_SalesOrderHeader.CompanyNote, dbo.tbl_SalesOrderHeader.Note, 
                      dbo.tbl_SalesOrderHeader.Status, dbo.tbl_SalesOrderHeader.QuoteSentThro, dbo.tbl_SalesOrderDetails.CliSno, dbo.tbl_SalesOrderDetails.Description, 
                      dbo.tbl_SalesOrderDetails.Size, dbo.tbl_SalesOrderDetails.Qty, dbo.tbl_SalesOrderDetails.Unitprice, dbo.tbl_SalesOrderDetails.Discount, 
                      dbo.tbl_SalesOrderDetails.Totalprice, dbo.tbl_SalesOrderClientAddress.Designation, dbo.tbl_SalesOrderClientAddress.Line1, dbo.tbl_SalesOrderClientAddress.Line2, 
                      dbo.tbl_SalesOrderClientAddress.Line3, dbo.tbl_SalesOrderClientAddress.Line4, dbo.tbl_SalesOrderClientAddress.City, dbo.tbl_SalesOrderClientAddress.State, 
                      dbo.tbl_SalesOrderClientAddress.District, dbo.tbl_SalesOrderClientAddress.Country, dbo.tbl_SalesOrderClientAddress.PostalCode, dbo.tbl_SalesOrderClientAddress.Phone, 
                      dbo.tbl_SalesOrderClientAddress.Mobile, dbo.tbl_SalesOrderDetails.Pro_ItemCode as Email, dbo.tbl_UserMaster.Designation AS Designation1, dbo.tbl_UserMaster.ContactNo, 
                      dbo.tbl_SalesOrderHeader.OfficeName, tbl_OurCompanyDetail_1.Line1 AS OCLine1, tbl_OurCompanyDetail_1.Line2 AS OCLine2, 
                      tbl_OurCompanyDetail_1.Line3 AS OCLine3, tbl_OurCompanyDetail_1.District AS OCDistrict, tbl_OurCompanyDetail_1.City AS OCCity, 
                      tbl_OurCompanyDetail_1.PostalCode AS OCPostalCode, tbl_OurCompanyDetail_1.PhoneNo AS OCPhoneNo, tbl_OurCompanyDetail_1.FaxNo AS OCFaxNo, 
                      tbl_OurCompanyDetail_1.Email AS OCEmail, tbl_OurCompanyDetail_1.Website AS OCWebsite, tbl_OurCompanyDetail_1.TinNo AS OCTinNo, 
                      tbl_OurCompanyDetail_1.Cstno AS OCCstno, tbl_OurCompanyDetail_1.AreaCode AS OCAreaCode, dbo.tbl_SalesOrderHeader.RefRevNo, 
                      dbo.tbl_SalesOrderHeader.EnquiryRefNo as OtherRefNo, dbo.tbl_SalesOrderHeader.ClientEnqDt, dbo.tbl_SalesOrderHeader.ClientDueDt, dbo.tbl_SalesOrderHeader.KeyPerson, 
                      dbo.tbl_OurCompanyDetail.CompanyName, dbo.tbl_OurCompanyDetail.Line1 AS OCNewLine1, dbo.tbl_OurCompanyDetail.Line2 AS OCNewLine2, 
                      dbo.tbl_OurCompanyDetail.Line3 AS OCNewLine3, dbo.tbl_OurCompanyDetail.District AS OCNewDistrict, dbo.tbl_OurCompanyDetail.City AS OCNewCity, 
                      dbo.tbl_OurCompanyDetail.PostalCode AS OCNewPostalCode, dbo.tbl_OurCompanyDetail.PhoneNo AS OCNewPhoneNo, 
                      dbo.tbl_OurCompanyDetail.Email AS OCNewEmail, dbo.tbl_SalesOrderDetails.Availability, dbo.tbl_SalesOrderHeader.Currency, dbo.tbl_SalesOrderDetails.ClientCode, 
                      dbo.tbl_SalesOrderDetails.ID, dbo.tbl_SalesOrderHeader.Subject as ProjectName ,tbl_SalesOrderHeader.Octrai,tbl_SalesOrderHeader.ExciseDuty,tbl_SalesOrderHeader.GuranteeWaranty,tbl_SalesOrderHeader.OtherLabel,tbl_SalesOrderHeader.OtherText
FROM         dbo.tbl_OurCompanyDetail RIGHT OUTER JOIN
                      dbo.tbl_SalesOrderHeader INNER JOIN
                      dbo.tbl_SalesOrderDetails ON dbo.tbl_SalesOrderHeader.Refno = dbo.tbl_SalesOrderDetails.RefNo INNER JOIN
                      dbo.tbl_SalesOrderClientAddress ON dbo.tbl_SalesOrderHeader.Refno = dbo.tbl_SalesOrderClientAddress.Refno AND 
                      dbo.tbl_SalesOrderDetails.RefNo = dbo.tbl_SalesOrderClientAddress.Refno LEFT JOIN
                      dbo.tbl_UserMaster ON dbo.tbl_SalesOrderHeader.Authorised = dbo.tbl_UserMaster.UserFullName ON 
                      dbo.tbl_OurCompanyDetail.OfficeName = dbo.tbl_SalesOrderHeader.CompanyNote LEFT OUTER JOIN
                      dbo.tbl_OurCompanyDetail AS tbl_OurCompanyDetail_1 ON dbo.tbl_SalesOrderHeader.OfficeName = tbl_OurCompanyDetail_1.OfficeName

GO

EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[64] 4[12] 2[11] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "tbl_OurCompanyDetail"
            Begin Extent = 
               Top = 8
               Left = 1133
               Bottom = 342
               Right = 1294
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "tbl_SalesOrderHeader"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 421
               Right = 226
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "tbl_SalesOrderDetails"
            Begin Extent = 
               Top = 23
               Left = 313
               Bottom = 350
               Right = 462
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "tbl_SalesOrderClientAddress"
            Begin Extent = 
               Top = 0
               Left = 544
               Bottom = 367
               Right = 710
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "tbl_UserMaster"
            Begin Extent = 
               Top = 0
               Left = 751
               Bottom = 304
               Right = 915
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "tbl_OurCompanyDetail_1"
            Begin Extent = 
               Top = 69
               Left = 922
               Bottom = 411
               Right = 1077
            End
            DisplayFlags = 280
            TopColumn = 2
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths =' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_SalesOrder'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane2', @value=N' 73
         Width = 284
         Width = 3150
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_SalesOrder'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=2 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'View_SalesOrder'
GO

我到处搜索解决方案,但没找到确切的解决方案。

我也读过有关扩展属性的内容,但在我的情况下,我并没有准确地解决它。

如果有任何想法,请尽早回复。

提前致谢

2 个答案:

答案 0 :(得分:1)

我认为该消息是相当自我解释的 - 您已经超过了其中一个扩展属性的最大字节数。 - 特别是它的名字:MS_DiagramPane1

刚做了一个快速测试 - 该属性有3752个字符,假设UNICODE(或类似)编码将达到7504字节。

这意味着您只是略微超过该扩展属性的最大字节数。如果您刚刚删除了一些空白字符,那就没问题了(我已经快速测试了这个!)

答案 1 :(得分:0)

扩展属性是可选的。如果您在GO之后删除所有内容,则仍会创建视图并且不会对您的应用程序产生影响......

create VIEW [dbo].[View_SalesOrder]
AS
SELECT     dbo.tbl_SalesOrderHeader.Refno, dbo.tbl_SalesOrderHeader.RefNoDate, dbo.tbl_SalesOrderHeader.Authorised, dbo.tbl_SalesOrderHeader.ClientCompanyName, 
                      dbo.tbl_SalesOrderHeader.ClientBranch, dbo.tbl_SalesOrderHeader.ClientPerson, dbo.tbl_SalesOrderHeader.TypeOfEnquiry, dbo.tbl_SalesOrderHeader.EnquiryDate, 
                      dbo.tbl_SalesOrderHeader.DueDate, dbo.tbl_SalesOrderHeader.Delivery, dbo.tbl_SalesOrderHeader.PF, dbo.tbl_SalesOrderHeader.Tax, dbo.tbl_SalesOrderHeader.Payment, 
                      dbo.tbl_SalesOrderHeader.Validity, dbo.tbl_SalesOrderHeader.Frieght, dbo.tbl_SalesOrderHeader.CompanyNote, dbo.tbl_SalesOrderHeader.Note, 
                      dbo.tbl_SalesOrderHeader.Status, dbo.tbl_SalesOrderHeader.QuoteSentThro, dbo.tbl_SalesOrderDetails.CliSno, dbo.tbl_SalesOrderDetails.Description, 
                      dbo.tbl_SalesOrderDetails.Size, dbo.tbl_SalesOrderDetails.Qty, dbo.tbl_SalesOrderDetails.Unitprice, dbo.tbl_SalesOrderDetails.Discount, 
                      dbo.tbl_SalesOrderDetails.Totalprice, dbo.tbl_SalesOrderClientAddress.Designation, dbo.tbl_SalesOrderClientAddress.Line1, dbo.tbl_SalesOrderClientAddress.Line2, 
                      dbo.tbl_SalesOrderClientAddress.Line3, dbo.tbl_SalesOrderClientAddress.Line4, dbo.tbl_SalesOrderClientAddress.City, dbo.tbl_SalesOrderClientAddress.State, 
                      dbo.tbl_SalesOrderClientAddress.District, dbo.tbl_SalesOrderClientAddress.Country, dbo.tbl_SalesOrderClientAddress.PostalCode, dbo.tbl_SalesOrderClientAddress.Phone, 
                      dbo.tbl_SalesOrderClientAddress.Mobile, dbo.tbl_SalesOrderDetails.Pro_ItemCode as Email, dbo.tbl_UserMaster.Designation AS Designation1, dbo.tbl_UserMaster.ContactNo, 
                      dbo.tbl_SalesOrderHeader.OfficeName, tbl_OurCompanyDetail_1.Line1 AS OCLine1, tbl_OurCompanyDetail_1.Line2 AS OCLine2, 
                      tbl_OurCompanyDetail_1.Line3 AS OCLine3, tbl_OurCompanyDetail_1.District AS OCDistrict, tbl_OurCompanyDetail_1.City AS OCCity, 
                      tbl_OurCompanyDetail_1.PostalCode AS OCPostalCode, tbl_OurCompanyDetail_1.PhoneNo AS OCPhoneNo, tbl_OurCompanyDetail_1.FaxNo AS OCFaxNo, 
                      tbl_OurCompanyDetail_1.Email AS OCEmail, tbl_OurCompanyDetail_1.Website AS OCWebsite, tbl_OurCompanyDetail_1.TinNo AS OCTinNo, 
                      tbl_OurCompanyDetail_1.Cstno AS OCCstno, tbl_OurCompanyDetail_1.AreaCode AS OCAreaCode, dbo.tbl_SalesOrderHeader.RefRevNo, 
                      dbo.tbl_SalesOrderHeader.EnquiryRefNo as OtherRefNo, dbo.tbl_SalesOrderHeader.ClientEnqDt, dbo.tbl_SalesOrderHeader.ClientDueDt, dbo.tbl_SalesOrderHeader.KeyPerson, 
                      dbo.tbl_OurCompanyDetail.CompanyName, dbo.tbl_OurCompanyDetail.Line1 AS OCNewLine1, dbo.tbl_OurCompanyDetail.Line2 AS OCNewLine2, 
                      dbo.tbl_OurCompanyDetail.Line3 AS OCNewLine3, dbo.tbl_OurCompanyDetail.District AS OCNewDistrict, dbo.tbl_OurCompanyDetail.City AS OCNewCity, 
                      dbo.tbl_OurCompanyDetail.PostalCode AS OCNewPostalCode, dbo.tbl_OurCompanyDetail.PhoneNo AS OCNewPhoneNo, 
                      dbo.tbl_OurCompanyDetail.Email AS OCNewEmail, dbo.tbl_SalesOrderDetails.Availability, dbo.tbl_SalesOrderHeader.Currency, dbo.tbl_SalesOrderDetails.ClientCode, 
                      dbo.tbl_SalesOrderDetails.ID, dbo.tbl_SalesOrderHeader.Subject as ProjectName ,tbl_SalesOrderHeader.Octrai,tbl_SalesOrderHeader.ExciseDuty,tbl_SalesOrderHeader.GuranteeWaranty,tbl_SalesOrderHeader.OtherLabel,tbl_SalesOrderHeader.OtherText
FROM         dbo.tbl_OurCompanyDetail RIGHT OUTER JOIN
                      dbo.tbl_SalesOrderHeader INNER JOIN
                      dbo.tbl_SalesOrderDetails ON dbo.tbl_SalesOrderHeader.Refno = dbo.tbl_SalesOrderDetails.RefNo INNER JOIN
                      dbo.tbl_SalesOrderClientAddress ON dbo.tbl_SalesOrderHeader.Refno = dbo.tbl_SalesOrderClientAddress.Refno AND 
                      dbo.tbl_SalesOrderDetails.RefNo = dbo.tbl_SalesOrderClientAddress.Refno LEFT JOIN
                      dbo.tbl_UserMaster ON dbo.tbl_SalesOrderHeader.Authorised = dbo.tbl_UserMaster.UserFullName ON 
                      dbo.tbl_OurCompanyDetail.OfficeName = dbo.tbl_SalesOrderHeader.CompanyNote LEFT OUTER JOIN
                      dbo.tbl_OurCompanyDetail AS tbl_OurCompanyDetail_1 ON dbo.tbl_SalesOrderHeader.OfficeName = tbl_OurCompanyDetail_1.OfficeName

GO