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

推荐文章

  • 如何在Ruby On Rails中使用NuoDB手动执行SQL命令
  • 查询JSON类型内的数组元素
  • 确定记录是否存在的最快方法
  • 获得PostgreSQL数据库中当前连接数的正确查询
  • 在SQL选择语句Order By 1的目的是什么?
  • 从现有模式生成表关系图(SQL Server)
  • 我如何循环通过一组记录在SQL Server?
  • 数据库和模式的区别
  • 如何在SQL Server中一次更改多个列
  • 如何从命令行通过mysql运行一个查询?
  • 外键约束可能导致循环或多条级联路径?
  • 使用LIMIT/OFFSET运行查询,还可以获得总行数
  • 当恢复sql时,psql无效命令\N
  • 货币应该使用哪种数据类型?
  • 如何选择每一行的列值不是独特的

aliyun

最新文章

  • 如何删除默认的导航栏空间在SwiftUI导航视图
  • 我可以列出所有的标准Go包吗?
  • 证书验证失败:无法获得本地颁发者证书
  • 警告:API ' variable . getjavacompile()'已过时,已被' variable . getjavacompileprovider()'取代
  • 打开同一目录两次
  • 实体框架核心:在上一个操作完成之前,在此上下文中开始的第二个操作
  • NullInjectorError: AngularFirestore没有提供程序
  • 如何为构造函数定制Visual Studio的私有字段生成快捷方式?
  • 从元组/数组值派生联合类型
  • 如何在Angular2中截断文本?
  • 安装tzdata非交互式
  • ionic 2 - Error在Android Studio中找不到Gradle的安装版本
  • 如何查看所有地区所有正在运行的Amazon EC2实例?
  • 当使用pip3安装包时,“Python中的ssl模块不可用”
  • 安装APK时出现错误

标签

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