programing

SQL Server에 동등한 것이 없는 경우 테이블 생성

codeshow 2023. 4. 7. 21:47
반응형

SQL Server에 동등한 것이 없는 경우 테이블 생성

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테이블이 아직 존재하지 않는 경우.

언급URL : https://stackoverflow.com/questions/6520999/create-table-if-not-exists-equivalent-in-sql-server

반응형