使用 INSERT 和 SELECT 添加行

 

若要通过另一个表中的值创建新表
SELECT LastName, FirstName, Phone
INTO dbo.PhoneList492
FROM Person.Contact
WHERE Phone LIKE '492%'

 

使用 VALUES 子句为一行指定数据值
INSERT INTO MyTable (PriKey, Description)
VALUES (123, 'A description of part 123.')

 

使用 SELECT 子查询为一行或多行指定数据值
INSERT INTO MyTable  (PriKey, Description)
SELECT ForeignKey, Description
FROM SomeView

相关文章:

  • 2021-05-24
  • 2021-11-23
  • 2022-02-25
  • 2021-12-05
  • 2022-12-23
  • 2022-01-18
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案