none
エラーメッセージ208オブジェクト名'T_PU_Detail'が無効です RRS feed

  • 質問

  • お世話になります.WinXP SP3, SQL Server 2005です.

    SQL Server Management Studio上で下記の8個のテーブルをもとに最後に記載したクエリを実行しようとしていますが,表題のエラーのためにクエリが失敗します.なぜでしょうか?コピーペーストでオブジェクト名を貼り付けていますのでタイプミスではないと思います.
    よろしくお願いします.

    CREATE TABLE [dbo].[T_PU_Granulation_Tissue_Colors](
     [granulation_tissue_colors] [nvarchar](50) NOT NULL,
     [granulation_tissue_colors_description] [nvarchar](50) NOT NULL,
     CONSTRAINT [PK_T_Granulation_Tissues_Colors] PRIMARY KEY CLUSTERED

    CREATE TABLE [dbo].[T_DESIGNR_Depth](
     [DESIGNR_Depth_Status] [nvarchar](2) NOT NULL,
     [DESIGNR_Depth_Description] [nvarchar](50) NOT NULL,
     [Depth_Score] [int] NOT NULL,
     [guideline_version] [nvarchar](10) NOT NULL,
     [DESIGN_Depth_Status] [nchar](2) NOT NULL,
     CONSTRAINT [PK_T_DESIGNR_Depth] PRIMARY KEY CLUSTERED

    CREATE TABLE [dbo].[T_DESIGNR_Exudate](
     [DESIGNR_Exudate_Status] [nvarchar](3) NOT NULL,
     [DESIGNR_Exudate_Description] [nvarchar](50) NOT NULL,
     [LowerFrequency] [float] NOT NULL,
     [UpperFrequency] [float] NOT NULL,
     [Exudate_Score] [int] NOT NULL,
     [guideline_version] [nvarchar](10) NOT NULL,
     [DESIGN_Exudate_Status] [nchar](2) NOT NULL,
     CONSTRAINT [PK_T_DESIGNR_Exudate] PRIMARY KEY CLUSTERED

    CREATE TABLE [dbo].[T_DESIGNR_Size](
     [DESIGNR_Size_Status] [nvarchar](3) NOT NULL,
     [DESIGNR_Size_Description] [nvarchar](50) NOT NULL,
     [LowerArea] [decimal](8, 2) NOT NULL,
     [UpperArea] [decimal](8, 2) NOT NULL,
     [Size_Score] [int] NOT NULL,
     [guideline_version] [nvarchar](10) NOT NULL,
     [DESIGN_Size_Status] [nchar](2) NOT NULL,
     CONSTRAINT [PK_T_DESIGNR_Size] PRIMARY KEY CLUSTERED

    CREATE TABLE [dbo].[T_DESIGNR_Inflammation_Infection](
     [DESIGNR_Inflammation_Infection_Status] [nvarchar](3) NOT NULL,
     [DESIGNR_Inflammation_Infection_Description] [nvarchar](50) NOT NULL,
     [Inflammation_Infection_Score] [int] NOT NULL,
     [guideline_version] [nvarchar](10) NOT NULL,
     [DESIGN_Inflammation_Infection_Status] [nchar](2) NOT NULL,
     CONSTRAINT [PK_T_DESIGNR_Inflammation_Infection] PRIMARY KEY CLUSTERED

    CREATE TABLE [dbo].[T_DESIGNR_Granuloma](
     [DESIGNR_Granuloma_Status] [nvarchar](3) NOT NULL,
     [DESIGNR_Granuloma_Description] [nvarchar](50) NOT NULL,
     [Granuloma_Score] [int] NOT NULL,
     [guideline_version] [nvarchar](10) NOT NULL,
     [DESIGN_Granuloma_Status] [nchar](2) NOT NULL,
     CONSTRAINT [PK_T_DESIGNR_Granuloma] PRIMARY KEY CLUSTERED

    CREATE TABLE [dbo].[T_DESIGNR_Necrosis](
     [DESIGNR_Necrosis_Status] [nvarchar](3) NOT NULL,
     [DESIGNR_Necrosis_Description] [nvarchar](50) NOT NULL,
     [Necrosis_Score] [int] NOT NULL,
     [guideline_version] [nvarchar](10) NOT NULL,
     [DESIGN_Necrosis_Status] [nchar](2) NOT NULL,
     CONSTRAINT [PK_T_DESIGNR_Necrosis] PRIMARY KEY CLUSTERED

    CREATE TABLE [dbo].[T_DESIGNR_Pocket](
     [DESIGNR_Pocket_Status] [nvarchar](3) NOT NULL,
     [DESIGNR_Pocket_Description] [nvarchar](50) NOT NULL,
     [MinArea] [decimal](8, 2) NOT NULL,
     [MaxArea] [decimal](8, 2) NOT NULL,
     [Pocket_Score] [int] NOT NULL,
     [guideline_version] [nvarchar](10) NOT NULL,
     [DESIGN_Pocket_Status] [nchar](2) NOT NULL,
     CONSTRAINT [PK_T_DESIGNR_Pocket] PRIMARY KEY CLUSTERED

    SELECT Depth_Score
        + Exudate_Score
        + Size_Score
        + Inflammation_Infection_Score
        + Granuloma_Score
        + Necrosis_Score
        + Pocket_Score  AS DESIGNR_Score
          FROM T_PU_Detail   AS PUD1
       INNER JOIN T_DESIGNR_Depth  AS D1
         ON PUD1.Depth_Status = D1.DESIGNR_Depth_Status
       INNER JOIN T_DESIGNR_Exudate AS E1
         ON PUD1.Exudate_Status = E1.DESIGNR_Exudate_Status
       INNER JOIN T_DESIGNR_Size  AS S1
         ON PUD1.Size_Status = S1.DESIGNR_Size_Status
       INNER JOIN T_DESIGNR_Inflammation_Infection AS I1
         ON PUD1.Inflammation_Infection_Status = I1.DESIGNR_Inflammation_Infection_Status
       INNER JOIN T_DESIGNR_Granuloma AS G1
         ON PUD1.Granuloma_Status = G1.DESIGNR_Granuloma_Status
       INNER JOIN T_DESIGNR_Necrosis AS N1
         ON PUD1.Necrosis_Status = N1.DESIGNR_Necrorsis_Status
       INNER JOIN T_DESIGNR_Pocket AS P1
         ON PUD1.Pocket_Status = P1.DESIGNR_Pocket_Status;
    2009年7月24日 9:35

回答

  • エラーメッセージの通りです。
    きっとコピー元が間違っているのでしょう。
    • 回答としてマーク じふ 2009年7月25日 21:41
    2009年7月24日 10:49
  • こんにちは、nagino です。

    クエリで「T_PU_Detail」を指定していますが、8 個のテーブルの中にそのようなテーブルが無いため、エラーになっているのでは無いでしょうか。

    SELECT Depth_Score 
        + Exudate_Score 
        + Size_Score 
        + Inflammation_Infection_Score 
        + Granuloma_Score 
        + Necrosis_Score 
        + Pocket_Score  AS DESIGNR_Score
          FROM T_PU_Detail   AS PUD1
       INNER JOIN T_DESIGNR_Depth  AS D1
         ON PUD1.Depth_Status = D1.DESIGNR_Depth_Status 
       INNER JOIN T_DESIGNR_Exudate AS E1 
         ON PUD1.Exudate_Status = E1.DESIGNR_Exudate_Status 
       INNER JOIN T_DESIGNR_Size  AS S1 
         ON PUD1.Size_Status = S1.DESIGNR_Size_Status 
       INNER JOIN T_DESIGNR_Inflammation_Infection AS I1 
         ON PUD1.Inflammation_Infection_Status = I1.DESIGNR_Inflammation_Infection_Status 
       INNER JOIN T_DESIGNR_Granuloma AS G1 
         ON PUD1.Granuloma_Status = G1.DESIGNR_Granuloma_Status 
       INNER JOIN T_DESIGNR_Necrosis AS N1 
         ON PUD1.Necrosis_Status = N1.DESIGNR_Necrorsis_Status 
       INNER JOIN T_DESIGNR_Pocket AS P1 
         ON PUD1.Pocket_Status = P1.DESIGNR_Pocket_Status;


    MCITP(Database Developer/Database Administrator)
    • 回答としてマーク じふ 2009年7月25日 21:41
    2009年7月24日 10:49

すべての返信

  • エラーメッセージの通りです。
    きっとコピー元が間違っているのでしょう。
    • 回答としてマーク じふ 2009年7月25日 21:41
    2009年7月24日 10:49
  • こんにちは、nagino です。

    クエリで「T_PU_Detail」を指定していますが、8 個のテーブルの中にそのようなテーブルが無いため、エラーになっているのでは無いでしょうか。

    SELECT Depth_Score 
        + Exudate_Score 
        + Size_Score 
        + Inflammation_Infection_Score 
        + Granuloma_Score 
        + Necrosis_Score 
        + Pocket_Score  AS DESIGNR_Score
          FROM T_PU_Detail   AS PUD1
       INNER JOIN T_DESIGNR_Depth  AS D1
         ON PUD1.Depth_Status = D1.DESIGNR_Depth_Status 
       INNER JOIN T_DESIGNR_Exudate AS E1 
         ON PUD1.Exudate_Status = E1.DESIGNR_Exudate_Status 
       INNER JOIN T_DESIGNR_Size  AS S1 
         ON PUD1.Size_Status = S1.DESIGNR_Size_Status 
       INNER JOIN T_DESIGNR_Inflammation_Infection AS I1 
         ON PUD1.Inflammation_Infection_Status = I1.DESIGNR_Inflammation_Infection_Status 
       INNER JOIN T_DESIGNR_Granuloma AS G1 
         ON PUD1.Granuloma_Status = G1.DESIGNR_Granuloma_Status 
       INNER JOIN T_DESIGNR_Necrosis AS N1 
         ON PUD1.Necrosis_Status = N1.DESIGNR_Necrorsis_Status 
       INNER JOIN T_DESIGNR_Pocket AS P1 
         ON PUD1.Pocket_Status = P1.DESIGNR_Pocket_Status;


    MCITP(Database Developer/Database Administrator)
    • 回答としてマーク じふ 2009年7月25日 21:41
    2009年7月24日 10:49
  • お世話になります.確かにご指摘通りT_PU_Detailがありませんでした.質問の際にコピーしたつもりでしたが,抜けていました.

    質問に上げた8つのテーブルに下記テーブルを加えた9つのテーブルです.オブジェクトエクスプローラで該当するテーブルを右クリックして編集に入り,出てきたコードをコピーペーストしております.

    CREATE TABLE [dbo].[T_PU_Detail](
     [Pt_ID] [int] NOT NULL,
     [PU_Location_Code] [bigint] NOT NULL,
     [PU_StartDate] [datetime] NOT NULL,
     [PU_AssessmentDate] [datetime] NOT NULL,
     [PU_NextAssessmentDate] [datetime] NOT NULL,
     [guideline_version] [nvarchar](10) NOT NULL,
     [Depth_Status] [nvarchar](2) NOT NULL,
     [Exudate_Status] [nvarchar](3) NOT NULL,
     [Size_MajorAxis] [decimal](5, 2) NOT NULL,
     [Size_MaxDiameter] [decimal](5, 2) NOT NULL,
     [Size_Status] [nvarchar](3) NOT NULL,
     [Inflammation_Infection_Status] [nvarchar](3) NOT NULL,
     [Granuloma_Status] [nvarchar](3) NOT NULL,
     [Necrosis_Status] [nvarchar](3) NOT NULL,
     [Pocket_MajorAxis] [decimal](5, 2) NOT NULL,
     [Pocket_MaxDiameter] [decimal](5, 2) NOT NULL,
     [Pocket_Status] [nvarchar](3) NOT NULL,
     [DESIGNR_Score] [int] NOT NULL,
     [PU_picture] [varbinary](max) NULL,
     [PU_picture_path] [nvarchar](max) NULL,
     CONSTRAINT [PK_T_PU_Detail] PRIMARY KEY CLUSTERED
    (
     [Pt_ID] ASC,
     [PU_StartDate] ASC,
     [PU_Location_Code] ASC,
     [PU_AssessmentDate] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    2009年7月24日 13:29
  • 質問で上げたテーブル定義コードも不十分でした.主キー部分を追加します.質問で挙げた最初のT_PU_Granulation_Tissue_Colorsは不要でした.テーブル数は8つです.

    CREATE TABLE [dbo].[T_DESIGNR_Depth](
     [DESIGNR_Depth_Status] [nvarchar](2) NOT NULL,
     [DESIGNR_Depth_Description] [nvarchar](50) NOT NULL,
     [Depth_Score] [int] NOT NULL,
     [guideline_version] [nvarchar](10) NOT NULL,
     [DESIGN_Depth_Status] [nchar](2) NOT NULL,
     CONSTRAINT [PK_T_DESIGNR_Depth] PRIMARY KEY CLUSTERED
    (
     [DESIGNR_Depth_Status] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]


    CREATE TABLE [dbo].[T_DESIGNR_Exudate](
     [DESIGNR_Exudate_Status] [nvarchar](3) NOT NULL,
     [DESIGNR_Exudate_Description] [nvarchar](50) NOT NULL,
     [LowerFrequency] [float] NOT NULL,
     [UpperFrequency] [float] NOT NULL,
     [Exudate_Score] [int] NOT NULL,
     [guideline_version] [nvarchar](10) NOT NULL,
     [DESIGN_Exudate_Status] [nchar](2) NOT NULL,
     CONSTRAINT [PK_T_DESIGNR_Exudate] PRIMARY KEY CLUSTERED
    (
     [DESIGNR_Exudate_Status] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    CREATE TABLE [dbo].[T_DESIGNR_Size](
     [DESIGNR_Size_Status] [nvarchar](3) NOT NULL,
     [DESIGNR_Size_Description] [nvarchar](50) NOT NULL,
     [LowerArea] [decimal](8, 2) NOT NULL,
     [UpperArea] [decimal](8, 2) NOT NULL,
     [Size_Score] [int] NOT NULL,
     [guideline_version] [nvarchar](10) NOT NULL,
     [DESIGN_Size_Status] [nchar](2) NOT NULL,
     CONSTRAINT [PK_T_DESIGNR_Size] PRIMARY KEY CLUSTERED
    (
     [DESIGNR_Size_Status] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    CREATE TABLE [dbo].[T_DESIGNR_Inflammation_Infection](
     [DESIGNR_Inflammation_Infection_Status] [nvarchar](3) NOT NULL,
     [DESIGNR_Inflammation_Infection_Description] [nvarchar](50) NOT NULL,
     [Inflammation_Infection_Score] [int] NOT NULL,
     [guideline_version] [nvarchar](10) NOT NULL,
     [DESIGN_Inflammation_Infection_Status] [nchar](2) NOT NULL,
     CONSTRAINT [PK_T_DESIGNR_Inflammation_Infection] PRIMARY KEY CLUSTERED
    (
     [DESIGNR_Inflammation_Infection_Status] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    CREATE TABLE [dbo].[T_DESIGNR_Granuloma](
     [DESIGNR_Granuloma_Status] [nvarchar](3) NOT NULL,
     [DESIGNR_Granuloma_Description] [nvarchar](50) NOT NULL,
     [Granuloma_Score] [int] NOT NULL,
     [guideline_version] [nvarchar](10) NOT NULL,
     [DESIGN_Granuloma_Status] [nchar](2) NOT NULL,
     CONSTRAINT [PK_T_DESIGNR_Granuloma] PRIMARY KEY CLUSTERED
    (
     [DESIGNR_Granuloma_Status] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    CREATE TABLE [dbo].[T_DESIGNR_Necrosis](
     [DESIGNR_Necrosis_Status] [nvarchar](3) NOT NULL,
     [DESIGNR_Necrosis_Description] [nvarchar](50) NOT NULL,
     [Necrosis_Score] [int] NOT NULL,
     [guideline_version] [nvarchar](10) NOT NULL,
     [DESIGN_Necrosis_Status] [nchar](2) NOT NULL,
     CONSTRAINT [PK_T_DESIGNR_Necrosis] PRIMARY KEY CLUSTERED
    (
     [DESIGNR_Necrosis_Status] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    CREATE TABLE [dbo].[T_DESIGNR_Pocket](
     [DESIGNR_Pocket_Status] [nvarchar](3) NOT NULL,
     [DESIGNR_Pocket_Description] [nvarchar](50) NOT NULL,
     [MinArea] [decimal](8, 2) NOT NULL,
     [MaxArea] [decimal](8, 2) NOT NULL,
     [Pocket_Score] [int] NOT NULL,
     [guideline_version] [nvarchar](10) NOT NULL,
     [DESIGN_Pocket_Status] [nchar](2) NOT NULL,
     CONSTRAINT [PK_T_DESIGNR_Pocket] PRIMARY KEY CLUSTERED
    (
     [DESIGNR_Pocket_Status] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    2009年7月24日 13:49
  • その後ですが,SQL Serverを再起動したらなぜか治りました.文法の問題かと思っていましたが別の理由がありそうです.
    2009年7月25日 21:19