DECLARE @t TABLE(date char(21))
INSERT @t SELECT '1900-1-1 00:00:00.000'
INSERT @t SELECT '1900-1-1 00:00:00.001'
INSERT @t SELECT '1900-1-1 00:00:00.009'
INSERT @t SELECT '1900-1-1 00:00:00.002'
INSERT @t SELECT '1900-1-1 00:00:00.003'
INSERT @t SELECT '1900-1-1 00:00:00.004'
INSERT @t SELECT '1900-1-1 00:00:00.005'
INSERT @t SELECT '1900-1-1 00:00:00.006'
INSERT @t SELECT '1900-1-1 00:00:00.007'
INSERT @t SELECT '1900-1-1 00:00:00.008'
SELECT date,转换后的日期=CAST(date as datetime) FROM @t

DECLARE @t TABLE(date char(21)) --定義一個表 @t,含有一列date ,char型,長度21
INSERT @t SELECT '1900-1-1 00:00:00.000' --把'1900-1-1 00:00:00.000'插入到@t

DECLARE @t TABLE(date char(21))创建一个名称为t的临时表变量,和表一样,只是在内存上创建的,而不是在硬盘上创建的,速度快.参见declare帮助.
INSERT @t SELECT '1900-1-1 00:00:00.000'向临时表变量中插入值,等价于insert @t(date) values(''1900-1-1 00:00:00.000').参见insert帮助.

declare @t table的更多相关文章

  1. (转)create table #temptable 临时表 和 declare @bianliang table ()表变量

    在开发过程中,经常会遇到使用表变量和本地临时表的情况.下面是对二者的一个介绍: 1. 为什么要使用表变量 表变量是从2000开始引入的,微软认为与本地临时表相比,表变量具有如下优点:  a.与其他变量 ...

  2. SQL Server中的临时表和表变量 Declare @Tablename Table

    在SQL Server的性能调优中,有一个不可比面的问题:那就是如何在一段需要长时间的代码或被频繁调用的代码中处理临时数据集?表变量和临时表是两种选择.记得在给一家国内首屈一指的海运公司作SQL Se ...

  3. create table #temptable 临时表 和 declare @bianliang table ()表变量

    create table #temptable 临时表 和 declare @bianliang table ()表变量 在开发过程中,经常会遇到使用表变量和本地临时表的情况.下面是对二者的一个介绍: ...

  4. T-SQL Recipes之 Table Variables and Temporary Tables

    Problem 许多时候, 我们想要Table Variables在动态SQL中执行,但现实是很骨感的.比如这个示例: DECLARE @sql_command NVARCHAR(MAX); DECL ...

  5. SQL:将字符串以特定字符分割并返回Table

    split 语法 ALTER FUNCTION [dbo].[F_SPLIT] ( @str VARCHAR(MAX) , ) ) /********************************* ...

  6. Declare Cusror of SQLServer

    Defines the attributes of a Transact-SQL server cursor, such as its scrolling behavior and the query ...

  7. SQLServer temporary table and table variable

    Temporary tables are created in tempdb.  The name "temporary" is slightly misleading, for ...

  8. 查询Table name, Column name, 拼接执行sql文本, 游标, 存储过程, 临时表

    018_Proc_UpdateTranslations.sql: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO if (exists (select ...

  9. SqlServer存储过程传入Table参数

    今天是周日,刚好有空闲时间整理一下这些天工作业务中遇到的问题. 有时候我们有这样一个需求,就是在后台中传过来一个IList<类>的泛型集合数据,该集合是某个类的实例集合体,然后将该集合中的 ...

随机推荐

  1. java的io操作(将字符串写入到txt文件中)

    import java.io.File;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java ...

  2. Quaternion Euler

    geometry_msgs::Quaternion orientation = map->info.origin.orientation;      tf::Matrix3x3 mat(tf:: ...

  3. 【NOI2016】优秀的拆分

    题目描述 如果一个字符串可以被拆分为 $AABB$ 的形式,其中 $A$ 和 $B$ 是任意非空字符串,则我们称该字符串的这种拆分是优秀的. 例如,对于字符串 aabaabaa,如果令 $A = \m ...

  4. 有关奇葩的mex编程时的matlab出现栈内存错误的问题

    错误提示信息 (ntdll.dll) (MATLAB.exe中)处有未经处理的异常:0xC0000374:堆已损坏 该错误的表现是,matlab调用.mexw64函数时,第一次调用正常,第二次调用出现 ...

  5. Overview of iOS Crash Reporting Tools: Part 1/2

    Believe it or not, developers are not perfect, and every once in a while you might have a (gasp!) bu ...

  6. 【java】java反射 Field类的研究使用

    java反射 Field类的研究使用 user.getClass().getFields() 和 user.getClass().getDeclaredFields(); 的区别是什么?

  7. selenium 定位元素方式大全

    starts-with 顾名思义,匹配一个属性开始位置的关键字 contains 匹配一个属性值中包含的字符串 text() 匹配的是显示文本信息,此处也可以用来做定位用 eg //input[sta ...

  8. JDBCUtils工具类

    JdbcUtils.java import java.sql.Connection; import java.sql.SQLException; import javax.sql.DataSource ...

  9. OPENDJ的安装图文说明

    一. 说明 介绍: opendj是一个ldap服务器 用于存储openam的配置和用户存储信息 准备工具: OpenDJ-3.0.0.zip 二. 安装步骤 a) Linux安装过程 1. 将zip包 ...

  10. 关于hibernate中映射中有many to one等外键关联时的问题

    hibernate中的对象的3种状态的理解及导致报错object references an unsaved transient instance - save the transient insta ...