sql - 插入 sql server 错误 : invalid object name

标签 sql sql-server

我有这个 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)

但我收到此错误消息:

Invalid object name 'TBL_VIDEOS'

最佳答案

您需要在描述中转义单引号:“世界领先的专家之一”

在这种情况下,我认为表的名称不是问题,但它们是多余的。

以下将起作用:

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)

关于sql - 插入 sql server 错误 : invalid object name,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12610787/

相关文章:

mysql - 如何合并两个具有不同列号的表? mysql

sql - 将整数格式化为字符串

python - Pyspark 等同于 Pyodbc?

php - 将小数精度的MSSQL时间转换为PHP时间和MySQL DateTime

mysql - 如何将两列的组合值复制到同一个表中的一列

sql - 基于一列将点分组到线串中,但前提是顺序遵循另一列的顺序

sql - 在 TSQL 错误消息之后获取文件中的行号

sql - 内部连接顺序和位置对性能有影响吗

sql - 备份 SQL SP 和函数的快速方法?

c# - 如何在C#中从SQL Server获得唯一值