• Add a column with default current date time
    ALTER TABLE [TableName]
    ADD CreatedOn DATETIME NOT NULL DEFAULT(GETDATE());
  • How to Quickly Create a Copy of a Table using Transact-SQL 
    The easiest way to create a copy of a table is to use a Transact-SQL command. Use SELECT INTO to extract all the rows from an existing table into the new table. The new table must not exist already. The following example will copy the Customers table under the Sales schema to a new table calledCurrCustomers under the BizDev schema:
    SELECT * INTO BizDev.CurrCustomers FROM Sales.Customers
    You can also create the new table from a specific subset of columns in the original table. In this case, you specify the names of the columns to copy after the SELECT keyword. Any columns not specified are excluded from the new table. The following example copies specific columns to a new table:
    SELECT CustName, Address, Telephone, Email INTO BizDev.CurrCustomers
    FROM Sales.Customers
  • Rename database
    ALTER DATABASE [CurrentDatabaseName]
    Modify Name = [NewDatabaseName]

SQL scripts的更多相关文章

  1. [MSSQL] Useful SQL Scripts - CalendarBase

    Useful SQL scripts DECLARE @StartDate DATETIME DECLARE @EndDate DATETIME DECLARE @FiscalBeginMonth I ...

  2. General Ledger Useful SQL Scripts – Oracle Applications 11i

    General Ledger Useful SQL Scripts – Oracle Applications 11i Contents GL Set of Books Configuration O ...

  3. General Ledger Useful SQL Scripts

    General Ledger Useful SQL Scripts – Oracle Applications 11i Contents GL Set of Books Configuration O ...

  4. 读书笔记--SQL必知必会--建立练习环境

    书目信息 中文名:<SQL必知必会(第4版)> 英文名:<Sams Teach Yourself SQL in 10 Minutes - Fourth Edition> MyS ...

  5. 初试WIX加SQL LocalDB

    最近有个项目需要生成一个自动打包安装App和数据库的MSI文件,经同事推荐WIX,于是乎就试了一试.遇到了一些问题觉得有分享的价值,所以写篇博客记录一下 :) 使用感觉: WIX特点:功能很强大,用X ...

  6. [转]Dynamic SQL & Stored Procedure Usage in T-SQL

    转自:http://www.sqlusa.com/bestpractices/training/scripts/dynamicsql/ Dynamic SQL & Stored Procedu ...

  7. Security Configuration and Auditing Scripts for Oracle E-Business Suite (文档 ID 2069190.1)

    This document provides the security configuration and auditing scripts for Oracle E-Business Suite. ...

  8. P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1

    P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1       May ...

  9. Database SQL script automation management tools investigation

    Recently researched about database SQL scripts auto management tools, recorded the results here. Res ...

随机推荐

  1. [深入浅出WP8.1(Runtime)]浮出控件(Flyout)

    4.15 浮出控件(Flyout) 浮出控件(Flyout)是一个轻型的辅助型的弹出控件,通常会作为提示或者要求用户进行相关的交互来使用.Flyout控件与Windows Phone里面的弹出框Mes ...

  2. [BZOJ2793][Poi2012]Vouchers

    2793: [Poi2012]Vouchers Time Limit: 20 Sec  Memory Limit: 64 MBSubmit: 316  Solved: 148[Submit][Stat ...

  3. Vijos 1092 全排列

    题目链接 来个水题..难得的1Y. #include <cstdio> #include <cstring> #include <iostream> using n ...

  4. Bootstrap_让Bootstrap轮播插件carousel支持左右滑动手势的三种方法

    Bootstrap 的 carousel.js 插件并没有支持手势. 3种解决方案 : jQuery Mobile (http://jquerymobile.com/download/) $(&quo ...

  5. 20145330第十周《Java学习笔记》

    20145330第十周<Java学习笔记> 网络编程 网络编程就是在两个或两个以上的设备(例如计算机)之间传输数据.程序员所作的事情就是把数据发送到指定的位置,或者接收到指定的数据,这个就 ...

  6. DBLINK 创建的注意事项

    摘自:http://blog.csdn.net/xulei_19850322/article/details/8219023 配置DBLINK细节很重要,请重点关注下面几点 1.确定被连接数据库可以连 ...

  7. python 之select

    服务端源码 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: zengchunyun "& ...

  8. mysql 主从同步原理

    Replication 线程 Mysql的 Replication 是一个异步的复制过程,从一个 Mysql instace(我们称之为 Master)复制到另一个 Mysql instance(我们 ...

  9. 李洪强iOS经典面试题上

    李洪强iOS经典面试题上     1. 风格纠错题 修改完的代码: 修改方法有很多种,现给出一种做示例: // .h文件 // http://weibo.com/luohanchenyilong/ / ...

  10. mvn生成runnablejar 的方法

    主要讲3点,生成runnable jar 方法1是生成一个目录 方法2是直接一个runnable的jar 方法3是关于包含spring工程的情况  方法2和3其实是一致的 1.生成runnable j ...