• 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. ACM 数独

    数独 时间限制:1000 ms  |  内存限制:65535 KB 难度:4   描述 数独是一种运用纸.笔进行演算的逻辑游戏.玩家需要根据9×9盘面上的已知数字,推理出所有剩余空格的数字,并满足每一 ...

  2. XML参考 :XmlReader 详解、实例

    XML参考 :XmlReader 详解.实例-- 详解 转:http://www.cnblogs.com/Dlonghow/archive/2008/07/28/1252191.html XML参考 ...

  3. C#:实现快捷键自定义设置(转)

    项目开发过程中,需要实现类似有道词典的软件设置中的自定义快捷键功能,如下图所示: 当我们相继按下Ctrl+Alt+M的时候,软件就会自动将快捷键显示在文本框中. 最终的效果如下图所示: private ...

  4. sign in和sign up区别

    如果是网站的话sign up是注册,sign in是登录的意思,另外,sign out退出

  5. super()和this()的区别

    1)调用super()必须写在子类构造方法的第一行,否则编译不通过.每个子类构造方法的第一条语句,都是隐含地调用super(),如果父类没有这种形式的构造函数,那么在编译的时候就会报错. 2)supe ...

  6. window常用命令(持续更新)

    1.netstat -ano 查看端口占用情况  可以根据PID到任务管理器中找到对应的进程 2.tasklist|findstr 进程号(pid) 查看pid是哪个程序启用的 3.taskkill ...

  7. 类似input框内最右边添加图标,有清空功能

    <html> <head> <meta http-equiv="Content-Type" content="text/html; char ...

  8. bootstrap 不兼容ie8 的问题

    官方推荐的脚手架中,其实已经包含着解决方案:html5shiv.min.js .Respond.min.js 但由于respond.js  使用 file:// 协议,IE8 是无法调起本地文件的   ...

  9. MySql的join(连接)查询 (三表 left join 写法)

    1.内连接:将两个表中存在连结关系的字段符合连接条件的记录形成记录集 Select A.name,B.name from A inner join B on A.id=B.id和 Select A.n ...

  10. mysql语句中有引号的问题解决方案

    在mysql的查询.修改.插入.删除的sql语句里有引号如何处理? 例如: <? $name = "my name is xcxc"; $people = "i'm ...