3

私はこのINSERTステートメントを持っています:

INSERT INTO TBL_VIDEOS (
  TBL_VIDEOS.ID,
  TBL_VIDEOS.TITLE,
  TBL_VIDEOS.V_DESCRIPTION,
  TBL_VIDEOS.UPLOAD_DATE,
  TBL_VIDEOS.V_VIEWS,
  TBL_VIDEOS.USERNAME,
  TBL_VIDEOS.RATING,
  TBL_VIDEOS.V_SOURCE,
  TBL_VIDEOS.FLAG
) 
VALUES 
('Z8MTRH3LmTVm',
'Why Creativity is the New Economy',
'Dr Richard Florida, one of the world's leading ...
    this stuff does not matter, it is just wasted space',
CURRENT_TIMESTAMP,
0,
1,
0,
'http://www.youtube.com/watch?v=VPX7gowr2vE&feature=g-all-u'
,0)

しかし、次のエラー メッセージが表示されます。

オブジェクト名「TBL_VIDEOS」が無効です

4

6 に答える 6

2

TBL_VIDEOSこの部分から削除します

INSERT INTO TBL_VIDEOS (
  TBL_VIDEOS.ID,
  TBL_VIDEOS.TITLE,
  TBL_VIDEOS.V_DESCRIPTION,
  TBL_VIDEOS.UPLOAD_DATE,
  TBL_VIDEOS.V_VIEWS,
  TBL_VIDEOS.USERNAME,
  TBL_VIDEOS.RATING,
  TBL_VIDEOS.V_SOURCE,
  TBL_VIDEOS.FLAG
) 

する必要があります

INSERT INTO TBL_VIDEOS (
  ID,
  TITLE,
  V_DESCRIPTION,
  UPLOAD_DATE,
  V_VIEWS,
  USERNAME,
  RATING,
  V_SOURCE,
  FLAG
  )

そして、あなたはこれを調べることができます、あなたがのようなコンテンツを持っているところはどこでもworld's leading expertsに変更されるべきworld''s leading expertsです。一重引用符を2回実行すると、一重引用符をエスケープできます

于 2012-09-26T21:37:15.613 に答える
2

説明の中の一重引用符をエスケープする必要があります: "one of the world's主要な専門家"

この場合、テーブルの名前が問題になるとは思いませんが、冗長です。

以下は動作します:

create table TBL_VIDEOS (
ID nvarchar(100), TITLE nvarchar(100), V_DESCRIPTION nvarchar(2000), UPLOAD_DATE nvarchar(100), V_VIEWS nvarchar(100), USERNAME nvarchar(100), RATING nvarchar(100), V_SOURCE nvarchar(100), FLAG nvarchar(100)
)

INSERT INTO TBL_VIDEOS ( 

 TBL_VIDEOS.ID, TBL_VIDEOS.TITLE, TBL_VIDEOS.V_DESCRIPTION, TBL_VIDEOS.UPLOAD_DATE, TBL_VIDEOS.V_VIEWS, TBL_VIDEOS.USERNAME, TBL_VIDEOS.RATING, TBL_VIDEOS.V_SOURCE, TBL_VIDEOS.FLAG) 

VALUES 

('Z8MTRH3LmTVm', 'Why Creativity is the New Economy', 'Dr Richard Florida, one of the world' + CHAR(39) + 's leading experts on economic competitiveness, demographic trends and cultural and technological innovation shows how developing the full human and creative capabilities of each individual, combined with institutional supports such as commercial innovation and new industry, will put us back on the path to economic and social prosperity.

Listen to the podcast of the full event including audience Q&A: http://www.thersa.org/events/audio-and-past-events/2012/why-creativity-is-the-new-economy

Our events are made possible with the support of our Fellowship. Support us by donating or applying to become a Fellow.

Donate: http://www.thersa.org/support-the-rsa Become a Fellow: http://www.thersa.org/fellowship/apply', CURRENT_TIMESTAMP, 0, 1, 0, 'http://www.youtube.com/watch?v=VPX7gowr2vE&feature=g-all-u' ,0)
于 2012-09-26T21:43:09.457 に答える
0

私の場合、SQL Server は COLUMNS 部分に一重引用符を使用するのが好きではなく、VALUES 部分に二重引用符を使用するのが好きではありません。

違う

INSERT INTO [sample].[dbo].[users]
('username', 'password')
VALUES('hello', 'hello')

INSERT INTO [sample].[dbo].[users]
("username", "password")
VALUES("hello", "world")

正しい

INSERT INTO [sample].[dbo].[users]
("username", "password")
VALUES('hello', 'world')
于 2020-08-11T00:52:10.557 に答える