简单的创建数据库的 SQL 语句: use master go if exists(select * from sysdatabases where name='Test') begin select '该数据库已存在' drop database Test --如果该数据库已经存在,那么就删除它 end else begin create database Test on primary --表示属于 primary 文件组 ( name='stuDB_data', -- 主数据文件的逻辑名称…
今天在网上查了下,根据旧表创建新表的SQL语句,网上给了两个答案 create table tab_new like tab_old (使用旧表创建新表) create table tab_new as select col1,col2- from tab_old definition only 两个语句都试了一下,报错了. 正确的方法是 select * into newtable from oldtable; 如果不想导记录,只想生成表结构 :select * into newtable f…