SQLServer2008新增TSQL简写语法计算机等级考试

文章作者 100test 发表时间 2010:01:01 08:26:23
来源 100Test.Com百考试题网


  1.定义变量时可以直接赋值
  DECLARE @Id int = 5
  2.Insert 语句可以一次插入多行数据
  INSERT INTO StateList VALUES(@Id, WA), (@Id 1, FL), (@Id 2, NY)
  3.支持 =操作符
  SET StateId = 1
  完整示例如下:
  view plaincopy to clipboardprint?CREATE TABLE StateList(StateId int, StateName char(2)) GO -- Declare variable and assign a value in a single statement DECLARE @Id int = 5 -- Insert multiple rows in a single statement with IDs 5, 6, and 7 INSERT INTO StateList VALUES(@Id, WA), (@Id 1, FL), (@Id 2, NY) -- Use compound assignment operator to increment ID values to 6, 7, and 8 UPDATE StateList SET StateId = 1 -- View the results SELECT * FROM StateList CREATE TABLE StateList(StateId int, StateName char(2))
  GO
  -- Declare variable and assign a value in a single statement
  DECLARE @Id int = 5
  -- Insert multiple rows in a single statement with IDs 5, 6, and 7
  INSERT INTO StateList VALUES(@Id, WA), (@Id 1, FL), (@Id 2, NY)
  -- Use compound assignment operator to increment ID values to 6, 7, and 8
  UPDATE StateList
  SET StateId = 1
  -- View the results
  SELECT * FROM StateList 结果集为:
  StateId StateName
  ------- ---------
  6 WA
  7 FL
  8 NY
  (3 row(s) affected)

相关文章


全国计算机等级考试三级网络模拟试题(1)计算机等级考试
MSSQLServer2005无法删除数据库作业计算机等级考试
sqlserver状态是正在挂起更改或服务因3414(0xD56)服务性错误而停止计算机等级考试
SQLServer2008Merge语句的OUTPUT功能计算机等级考试
SQLServer2008新增TSQL简写语法计算机等级考试
CPU选购经验谈计算机等级考试
VIACyrixIII处理器初识计算机等级考试
显卡价低也要注重品质计算机等级考试
怎样超频显卡计算机等级考试
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛