zoukankan      html  css  js  c++  java
  • Different between datetime and timestamp, and its setting

    According to the documentationtimestamp is a synonym for rowversion - it's automatically generated and guaranteed1 to be unique. datetime isn't - it's just a data type which handles dates and times, and can be client-specified on insert etc.

    Here is an example to use both datetime and timestamp in SQLSever . problem will happen, when you try to copy a datebase

    to a new database, then dates about the timestamp is not to copy........So what should we do about it. 

    USE [SWSK_YOSAN_161115]
    GO
    
    /****** Object:  Table [dbo].[T_TEST]    Script Date: 2017/01/27 11:55:09 ******/
    SET ANSI_NULLS ON
    GO
    
    SET QUOTED_IDENTIFIER ON
    GO
    
    SET ANSI_PADDING ON
    GO
    
    CREATE TABLE [dbo].[T_TEST](
        [JIGYOCD] [char](2) NOT NULL,
        [ORDERNO] [char](8) NOT NULL,
        [LASTUPDATEYMD] [datetime] NULL CONSTRAINT [DF_T_TEST_LASTUPDATEYMD]  DEFAULT (getdate()),
        [LASTUPDATEID] [varchar](20) NULL,
        [LASTUPDPGID] [varchar](20) NULL,
        [VERSIONNO] [timestamp] NULL,
     CONSTRAINT [PK_T_TEST] PRIMARY KEY CLUSTERED 
    (
        [JIGYOCD] ASC,
        [ORDERNO] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    
    GO
    
    SET ANSI_PADDING OFF
    GO
    SELECT [JIGYOCD]
    ,[ORDERNO]
    ,[LASTUPDATEYMD]
    ,[LASTUPDATEID]
    ,[LASTUPDPGID]
    ,[VERSIONNO]
    FROM [dbo].[T_TEST]
    GO
    
    
    

      

     
    Love it, and you live without it
  • 相关阅读:
    【转】数据库分页Java实现
    【转】ibatis的简介与初步搭建应用
    response.setContentType()的作用及参数
    【转】mysql数据库中实现内连接、左连接、右连接
    【转】JAVA的StringBuffer类
    【转】Java学习之Iterator(迭代器)的一般用法 (转)
    函数装饰器
    闭包函数
    函数(2)
    函数(1)
  • 原文地址:https://www.cnblogs.com/tomclock/p/6353699.html
Copyright © 2011-2022 走看看