Code
  • 首页
  • cpu-architecture
  • performance
  • c++
  • branch-prediction
  • java
2024-11-29 07:00:00

创建表如果在SQL Server中不存在

sqlsql-serversql-server-2008-r2

CREATE TABLE IF NOT EXISTS适用于mysql,但不适用于SQL Server 2008 R2。 等价的语法是什么?


if not exists (select * from sysobjects where name='cars' and xtype='U')
    create table cars (
        Name varchar(64) not null
    )
go

如果该表不存在,上面的操作将创建一个名为cars的表。

2011-06-29 12:59:51

推荐文章

  • 使用LIMIT/OFFSET运行查询,还可以获得总行数
  • 当恢复sql时,psql无效命令\N
  • 货币应该使用哪种数据类型?
  • 如何选择每一行的列值不是独特的
  • 如何改变字符集(和排序)在整个数据库?
  • mySQL:: insert到表,数据从另一个表?
  • nvarchar(max)非文本
  • 如何在Postgres中获得两个字段的MIN() ?
  • 在SQL Server 2008 R2中重命名数据库时出错
  • 将数据复制到另一个表中
  • 如何在SQL中选择表的最后一条记录?
  • SQL在Oracle中连接多行列值的查询
  • 修改列,添加默认约束
  • 在单个查询中计算空值和非空值
  • 在存储过程中使用“SET XACT_ABORT ON”有什么好处?

aliyun

最新文章

  • 二叉搜索树的定义中允许重复的键吗?
  • for循环和for-each循环在性能上有区别吗?
  • 你如何比较两个版本的字符串在Java?
  • 在c++中指针使用NULL或0(零)吗?
  • JavaScript:客户端验证与服务器端验证
  • 为什么在Java和。net中不能修改字符串?
  • 在c++中,如何将int值附加到字符串中?
  • 只用GitHub动作在特定分支上运行作业
  • “git restore”命令是什么?“git restore”和“git reset”之间有什么区别?
  • React钩子:从回调中访问最新状态
  • PreferenceManager getDefaultSharedPreferences在Android Q中已弃用
  • java.util.Random真的那么随机吗?我怎么能生成52!(阶乘)可能的序列?
  • 在CSS网格布局中等高行
  • 得到熊猫栏目的总数
  • 输入文件似乎是一个文本格式转储。请使用psql

标签

cpu-architectureperformancec++branch-predictionjavaundogit-commitgitversion-controlgit-remotegit-pushgit-branchgit-pullgit-fetchpythongeneratoriteratorjsonmime-typescontent-typearraysjavascriptgit-addcode-formattingcstandards-complianceoperatorscommentsdynamic-memory-allocationstackmemory-managementheap-memorylanguage-agnosticoverwritebackground-colorbrowserhtmldomjqueryvisibilityuse-strictsyntaxjslintremote-branchgit-checkoutpython-moduleidiomsprogram-entry-pointnamespacesbranch
2025 code 京ICP备15047053号-1